ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   If Function (https://www.excelbanter.com/excel-worksheet-functions/134263-if-function.html)

Victor Waller

If Function
 
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



Pete_UK

If Function
 
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

On Mar 10, 12:18 am, "Victor Waller" wrote:
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





All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com