Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

REGEX Combining multiple columns as comma separated

Topic Labels: Formulas
355 2
cancel
Showing results for 
Search instead for 
Did you mean: 
KFIL
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi community,

I have a formula to combine emails from multiple columns, that generally contain multiple linked records (but not always).  This REGEX formula works really well for the first 3 columns, but is failing on the final.  Any help on what I'm doing incorrectly would be greatly appreciated!

Goal: string together a list of email addresses from multiple columns, with a "comma" between them, but if a column is black, don't add ",".
 
Current Formula is:
 
REGEX_REPLACE(CONCATENATE(IF({Moderator Email}, {Moderator Email} & ", "), IF({ADM Primary Email}, {ADM Primary Email} & ", "), IF({Other Panelists Email (Primary)}, {Other Panelists Email (Primary)} & ", "), IF({Other Panelists Alternate Email}, {Other Panelists Alternate Email}) ), ", $", "" )
 
For some reason, the last 
{Other Panelists Alternate Email}. is not comma separated.  The result merges all 3 user emails into one long strain......
 
2 Replies 2
Mike_AutomaticN
10 - Mercury
10 - Mercury

Hey @KFIL!

Please give this updated formula a try:

REGEX_REPLACE(
    CONCATENATE(
        IF({Moderator Email}, {Moderator Email} & ", "),
        IF({ADM Primary Email}, {ADM Primary Email} & ", "),
        IF({Other Panelists Email (Primary)}, {Other Panelists Email (Primary)} & ", "),
        IF({Other Panelists Alternate Email}, {Other Panelists Alternate Email} & ", ")
    ),
    ", $",
    ""
)


Please let me know if that helps.

Mike, Consultant @ Automatic Nation

KFIL
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks!  I may have omitted a ",", but also seeing some interference with a lookup field.  Once I put into an ARRAYJOIN formula, it worked like a charm!  Appreciate the speedy help, @Mike_AutomaticN !!!!