Help

Re: Count lines in Long Text field with a formula

1341 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Rod_Tagle
5 - Automation Enthusiast
5 - Automation Enthusiast

Is there a way to count how many lines a Long Text field has with a formula?

Currently I am solving with adding a comma at the end of each line inside the Long Text field (LT_Field) and counting with this formula.

ABS(IF(LEN(SUBSTITUTE(TRIM({LT_Field}),",","")) > 1, LEN(SUBSTITUTE(TRIM({LT_Field}),",","")) - 1 , LEN(SUBSTITUTE(TRIM({LT_Field}),",",""))) - LEN(TRIM({LT_Field})))

This works fine but I don’t want to type the commas anymore and just use line breaks instead without my formula breaking:

one, two, three

to:

one
two
three
2 Replies 2

Replace all references to a comma "," in your formula with "\n".

\n is a “new line character” and Airtable uses them (in hidden form) to identify new lines in a Long Text field.

You can also use \n within a string in a formula to force a newline in the output text, just FYI.

image

ABS(IF(LEN(SUBSTITUTE(TRIM({LT_Field}),"\n","")) > 1, LEN(SUBSTITUTE(TRIM({LT_Field}),"\n","")) - 1 , LEN(SUBSTITUTE(TRIM({LT_Field}),"\n",""))) - LEN(TRIM({LT_Field})))

True MVP right here @Jeremy_Oglesby!! Thanks!