Excel Functions

C

Charlie

I need a function that will pull a character value from a specified cell and
string location so I can put it into an if statement to return a text string.

i.e.
Say I have this text string, AP10-FG1A1P, and I wanted to pull the value of
the 8th character. What do I use?

Find and Search are not returning the value, but only the position.
Right and Left return too many characters. Although they are good for the
first and last character value when needed.
 
R

RagDyeR

Do you consider the 8th character to be the "1", counting the dash:

=Right(Left(a1,8))

--

HTH,

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

I need a function that will pull a character value from a specified cell and
string location so I can put it into an if statement to return a text
string.

i.e.
Say I have this text string, AP10-FG1A1P, and I wanted to pull the value of
the 8th character. What do I use?

Find and Search are not returning the value, but only the position.
Right and Left return too many characters. Although they are good for the
first and last character value when needed.
 
C

Charlie

Now that I am able to pull the value of the character out of the string. I
need to use an IF statement to have TRUE/FALSE text returned.

=IF(MID(M3,8,2)=1,"1/8 NPT","1/4 NPT") This returns a False value, would you
know why?
M3 = AP10-FG1A1P
 
R

RagDyeR

Two reasons:

*FIRST*
Your formula is wrong!
It's returning "1A".

You should use:

=MID(M3,8,1)
OR
=Right(Left(M3,8))

*SECOND*

Text functions return TEXT, *not* true numbers.

=Right(Left(M3,8))
AND
=MID(M3,8,1)

Will return "1" *not* 1.

So, you *either* make the text formula return a true number:

=--Right(Left(M3,8))
=IF(--Right(Left(M3,8))=1,"1/8 NPT","1/4 NPT")
AND
=--MID(M3,8,1)
=IF(--MID(M3,8,1)=1,"1/8 NPT","1/4 NPT")

OR

You revise your IF() formula to look for a TEXT "1":

=IF(MID(M3,8,1)="1","1/8 NPT","1/4 NPT")
=IF(Right(Left(M3,8))="1","1/8 NPT","1/4 NPT")
--

HTH,

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


Now that I am able to pull the value of the character out of the string. I
need to use an IF statement to have TRUE/FALSE text returned.

=IF(MID(M3,8,2)=1,"1/8 NPT","1/4 NPT") This returns a False value, would you
know why?
M3 = AP10-FG1A1P
 

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