dimanche 27 novembre 2016

Wrapping a function within an if statement in MS Excel?

I have a function that removes part of a string after a comma, eg:

=LEFT(B3,FIND(",",B3)-1)

Eg: 123 West St, Sydney becomes 123 West St.

This works fine, but some of my cells don't have commas and so I get the #VALUE! error on these.

I've Googled and found 'IF(ISNUMBER)` and have made:

=IF(ISNUMBER(SEARCH(",",B3)),LEFT(B3,FIND(",",B3)-1))

but this just returns 'FALSE' on cells with no comma.

Is there a way to wrap this in an 'if' statement? Something like

if (B3 contains ','){=LEFT(B3,FIND(",",B3)-1)}

Aucun commentaire:

Enregistrer un commentaire