Use FIND for / or \ or -

B

Bert

appy New Year all,
I want to use the FIND function with LEFT to extract the numbers left of a
marker which could be / or \ or -
I can only see how to use FIND for one character how to use for multiple
possibilites? (so when FIND reaches / or \ or - it returns the position)
Thanks for any suggestions
Bert
 
R

RagDyeR

Try this:

=LEFT(A1,MIN(FIND({"/","\","-"},A1&"/\-"))-1)

And copy down as needed.
--

HTH,

RD
=====================================================
Please keep all correspondence within the Group, so all may benefit!
=====================================================

appy New Year all,
I want to use the FIND function with LEFT to extract the numbers left of a
marker which could be / or \ or -
I can only see how to use FIND for one character how to use for multiple
possibilites? (so when FIND reaches / or \ or - it returns the position)
Thanks for any suggestions
Bert
 
G

Gary''s Student

Instead of using:
=FIND()
use
=IF(ISERROR(FIND("-",A1,1)),0,FIND("-",A1,1))+IF(ISERROR(FIND("\",A1,1)),0,FIND("\",A1,1))+IF(ISERROR(FIND("/",A1,1)),0,FIND("/",A1,1))
 
C

CLR

Playing off of RD's really nifty solution, this one will return a blank if
there is no occurance of \, /, or- in the cells

=IF(LEFT(A1,MIN(FIND({"/","\","-"},A1&"/\-"))-1)=A1,"",LEFT(A1,MIN(FIND({"/","\","-"},A1&"/\-"))-1))

Vaya con Dios,
Chuck, CABGx3
 
T

Teethless mama

Another way...

=LEFT(A1,FIND("^",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"\","^"),"/","^"),"-","^"))-1)
 
R

Rick Rothstein \(MVP - VB\)

Why not just pick one of the search characters and then do only two
substitutions (one for each of the other characters)...

=LEFT(A1,FIND("\",SUBSTITUTE(SUBSTITUTE(A1,"/","\"),"-","\"))-1)

Rick
 
H

Harlan Grove

CLR said:
Playing off of RD's really nifty solution, this one will return a
blank if there is no occurance of \, /, or- in the cells

=IF(LEFT(A1,MIN(FIND({"/","\","-"},A1&"/\-"))-1)=A1,
"",LEFT(A1,MIN(FIND({"/","\","-"},A1&"/\-"))-1))
....

No need for multiple FIND calls.

=SUBSTITUTE(LEFT(A1,MIN(FIND({"/","\","-"},A1&"/\-"))-1),A1,"")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top