nested case sensitive if formula

ECB

Board Regular
Joined
Mar 3, 2009
Messages
63
Office Version
  1. 365
Platform
  1. MacOS
  2. Mobile
Hi all

I'm stuck again :)

I have a list of data of single letter values:

J
F
M
A
m
j
a
S
O
N
D

Which relates to January, February, March etc (There is no July)

Now, I want to write an if statement to convert the single text value to a number

eg:

=IF(L1="J",1,IF(L1="F",2,IF(L1="M",3,IF(L1="A",4,IF(L1="m",5)))))

Which doesn't work because the if is case insensitive - small m returns "3"

Anyone able to point out to me where I'm going wrong, or what would work instead?

TIA
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi all

I'm stuck again :)

I have a list of data of single letter values:

J
F
M
A
m
j
a
S
O
N
D

Which relates to January, February, March etc (There is no July)

Now, I want to write an if statement to convert the single text value to a number

eg:

=IF(L1="J",1,IF(L1="F",2,IF(L1="M",3,IF(L1="A",4,IF(L1="m",5)))))

Which doesn't work because the if is case insensitive - small m returns "3"

Anyone able to point out to me where I'm going wrong, or what would work instead?

TIA

Try...

Either:
Rich (BB code):
=LOOKUP(9.99999999999999E+307,FIND({"J";"F";"M";"A";"m"},L1),{1;2;3;4;5})

Or:
Rich (BB code):
=LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,
    LOOKUP(9.99999999999999E+307,FIND({"J";"F";"M";"A";"m"},L1),{1;2;3;4;5})))

The latter returns 0 in lieu of #N/A when necessary.
 
Upvote 0
Hi, Try

Array Formula, Confirmed with Control+Shift+Enter, not just Enter

=MATCH(CODE(A1),{74;70;77;65;109;106;97;83;79;78;68},0)+OR(EXACT({"a","S","O","N","D"},A1))
 
Last edited:
Upvote 0
Hi all

I'm stuck again :)

I have a list of data of single letter values:

J
F
M
A
m
j
a
S
O
N
D

Which relates to January, February, March etc (There is no July)

Now, I want to write an if statement to convert the single text value to a number

eg:

=IF(L1="J",1,IF(L1="F",2,IF(L1="M",3,IF(L1="A",4,IF(L1="m",5)))))

Which doesn't work because the if is case insensitive - small m returns "3"

Anyone able to point out to me where I'm going wrong, or what would work instead?

TIA
If there is no July then what value should be returned for "a" (August)?

Should it be 7 or 8?

If it should be 7, then:

=FIND(A1,"JFMAmjaSOND")

If it should be 8, then:

=FIND(A1,"JFMAmjaSOND")+(FIND(A1,"JFMAmjaSOND")>6)
 
Upvote 0
If it should be 8, then:

=FIND(A1,"JFMAmjaSOND")+(FIND(A1,"JFMAmjaSOND")>6)
Just a modification in Biff's formula. Since FIND looking for the first occurrence simply add a another "j",

=FIND(A1,"JFMAmjjaSOND")

I think should be Ok :)
 
Upvote 0
Guys (and Gals)

You astound me with your ingenuity as always.

Thank you all very much.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,879
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top