Problems with IF-function...

Closed
MouseBouse Posts 1 Registration date Sunday 10 March 2013 Status Member Last seen 10 March 2013 - 10 Mar 2013 à 15:02
Kevin@Radstock Posts 42 Registration date Thursday 31 January 2013 Status Member Last seen 26 April 2014 - 11 Mar 2013 à 01:56
Hello,

I'm using Excel 2003 (yes, still) and I'm having trouble with the IF function.
I have a 13-digit number in E2, and in F2 I want the function to say "yes" if the 10th digit is 5.

The value in E2 is: 1211990335073
So I've tried using: =IF(MID(E2;10;1)=5;"yes";"no"). So obviously, it should say yes, but it doesn't. What am I doing wrong?


2 responses

rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
10 Mar 2013 à 16:25
MID returns a specific number of characters from a text string, starting at the position you specify, based on the number of characters you specify.

You mid return is a string
=IF(MID(E2;10;1)="5";"yes";"no").
Kevin@Radstock Posts 42 Registration date Thursday 31 January 2013 Status Member Last seen 26 April 2014 9
11 Mar 2013 à 01:56
Hi MouseBouse

Another version, which could be used.

=IF(--MID(A1,9,1)=5,"yes","no")

Kevin