[SalesForce] Formula to split and wrap text values

I know the following is possible in Apex, but I'm wondering whether there's a way to do it with standard formula fields.

Is there a way to split up a value and wrap each bit in other text values? For example (not a real example:

Custom_Field_1 = 'This;That;Other;', but could have any number of terms.

Formula for Custom_Field_2 should wrap each term delimited by ; in <p></p> and remove the ; to result in <p>This</p><p>That</p><p>Other</p>.

Best Answer

A basic solution for the formula would be

'<p>' &  SUBSTITUTE(Custom_Field_1, ';', '</p><p>')   & '</p>'

You can add logic to test if Custom_Field_1 is blank and leave the formula field blank in that instance too if necessary.

Related Topic