2

I have a string that contains one or more email addresses, for example:

email1@example.com, email2@example.com

I want to select just the first email address, which is doable with something like

LEFT(EmailString(FIND(",",EmailString,1)-1)

That formula searches for a comma, but what do I do when there is only one value and no comma? If the email is simply email1@example.com then that formula throws an error on the find. Is there a better formula?

3

You can incorporate the IF and CONTAINS functions here:

IF(
    NOT(CONTAINS(EmailString, ',')),
    EmailString, /*your existing formula here*/
)

Basically, if there is no comma, just use the value, otherwise use the formula you already have.

1
  • OP could also append a comma to EmailString and use orig formula – cropredy Jul 19 '17 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.