If Function

V

Victor Waller

What is wrong about this formula??

=IF(MID(E57,2,1)=1,RIGHT(E57,1),"x")

I have a number 3106 in cell E57. I want the formula to perform the
following:

If the second digit from the left (which is 1) is equal to 1 then I want to
place the last digit (6) into a cell. Else if the second digit is not equal
to 1 then I want to place an X in the cell.

The above formula seems to be the correct choice but I get a VALUE error.

Can anyone tell what's wrong.

Vic
 
P

Pete_UK

MID returns a string, so you can't compare this directly with a
number. Change your formula to this:

=IF(MID(E57,2,1)="1",RIGHT(E57,1),"x")

(easiest), or this:

=IF(VALUE(MID(E57,2,1))=1,RIGHT(E57,1),"x")

Hope this helps.

Pete
 
Top