Dec 06, 2018 11:18 AM
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
Dec 06, 2018 11:52 AM
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.
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})))
Dec 06, 2018 01:01 PM
True MVP right here @Jeremy_Oglesby!! Thanks!