Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

How to replace commas with line breaks in a field

Topic Labels: Formulas
11611 15
cancel
Showing results for 
Search instead for 
Did you mean: 
Ron_Daniell
4 - Data Explorer
4 - Data Explorer

Currently I have a field that contains multiple products separated by commas.

Is there a way to “find” all commas and “replace” them with the “/n” line break?

I would like the product field which currently looks like this
“product1, product2, product3, product4”

to appear in the field as
product1
product2
product3
product4

Is there a way to do this?

15 Replies 15
Opher_Yunger
5 - Automation Enthusiast
5 - Automation Enthusiast

The roll up field is using

ARRAYJOIN(values)
and the field that is suppose to make it human readable is using

SUBSTITUTE({Items Purchased},",","\n")

If I make it ArrayUnique then I get an error in the Substitute field

@Opher_Yunger Are you using a rollup field and want each unique value on its own line? If so, try this formula in the rollup:

ARRAYJOIN(ARRAYUNIQUE(values), "\n")

The inner ARRAYUNIQUE returns only unique values. Then ARRAYJOIN joints the values into a text string joined with the specified character.

That was way easier. Thanks so much!
Is there a way to Alphabetize the Array?

No, there is no array function to sort an array. The elements are in the same order as the linked record field itself. You can alphabetize the linked records according to the primary field for the linked records using the bulk update block/app.

Jord1
4 - Data Explorer
4 - Data Explorer

@kuovonne I have the opposite challenge! I’d like to get a text field with URLs that now looks like this:

https://www.google.com,
https://www.facebook.com,
https://www.amazon.com

Which I’d like to replace the “,” with a “;” like this:
https://www.google.com;
https://www.facebook.com;
https://www.amazon.com

Super simple I’d say but its seems to behave differently than excel/numbers…

I’ve been looking for this solution for ages. Thanks so much. You are and always will be a superstar!