has five free-form data fields. All five fields are optional. The user wants to create a formula to consolidate the information from all five fields, one per line, without any blank lines.
Discussion
Here is the basic formula format. The user actually wants two new line characters \n\n between each field, but I am including only one in this formula.
TRIM(CONCATENATE(
IF({field1}, {field1} & "\n"),
IF({field2}, {field2} & "\n"),
IF({field3}, {field3} & "\n"),
IF({field4}, {field4} & "\n"),
IF({field5}, {field5} & "\n")
))
This formula works by checking each field if the field has a value, and if it does, combining the field value with a new line character. The CONCATENATE() combines all of these values and new line characters. Finally, any trailing line break is removed with TIRM().
Note that the final IF function combines the field value with the new line character, even though this last one will never be used.
It is easier to rearrange the order of the fields. Changing the order of fields only involves moving the lines and adjusting commas without also having to adding or removing the newline character.
Keeping the parallel structure for all the fields makes the formula easier to read and understand.