to many ifs

mamfa

New Member
Joined
Jun 23, 2006
Messages
25
i need some help as i have too many if functions with the formula i need to write. this is what the complete formula should be:
=IF(AB2="A*",0,IF(AB2="A",1,IF(AB2="B",2,IF(AB2="C",3,IF(AB2="D",4,IF(AB2="E",5,IF(AB2="F",6,IF(AB2="G",7,IF(AB2="U",8,"NA")))))))

it will cope until the last if but then it says theres to many i know abit about naming formulas but cant get that to work, and dumbed down help would be much appreciated

thanks
Samantha
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

DargonSwift

New Member
Joined
Aug 7, 2006
Messages
23
=MATCH(AB2,{"A","B","C","D","E","F","G","U"},0)

What do the curly braces do in this formula? (Stupid question I'm sure, but I'm not familiar with them). Also, and link (for beginners) to how special characters are used in Excel would be appreciated.
 

sunnyland

Well-known Member
Joined
Jan 27, 2006
Messages
912
Hello Aladin and Mamfa,

Another way to go using the match:

=MATCH(AB2,{"A*","A","B","C","D","E","F","G","U"},0)-1

or it will be easier maybe and to have more flexibilty [to add letter or whatever ] to create a 2 columns list

A* 0
A 1
........
U 7

and then to use a vlookup so

=VLOOKUP(ab2,G1:H8,2,FALSE)


May be?????
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209

ADVERTISEMENT

=MATCH(AB2,{"A","B","C","D","E","F","G","U"},0)

What do the curly braces do in this formula? (Stupid question I'm sure, but I'm not familiar with them). Also, and link (for beginners) to how special characters are used in Excel would be appreciated.

{"A","B","C","D","E","F","G","U"}

is a 1-column table. Also called a vector.

It's equivalent of having a range housing the same values: for eaxample, A2:A9 filled with A, B, C,.. respectively.

=MATCH(AB2,{"A","B","C","D","E","F","G","U"},0)

would then become:

=MATCH(AB2,$A$2:$A$9,0)

BTW, the formula omits your A* for it would be confused with A. If that's still relevant, try to clarify what values with A* are meant. If literal A*, modify the formula as Sunnyland suggests to:

=MATCH(AB2,{"A*","A","B","C","D","E","F","G","U"},0)-1
 

mamfa

New Member
Joined
Jun 23, 2006
Messages
25
the match thin looks good but i need a bit more explanation i need each grade to equal a number ???

thank you for your help
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209

ADVERTISEMENT

the match thin looks good but i need a bit more explanation i need each grade to equal a number ???

thank you for your help

You listed 0,1,2,... as numbers that are associated with the symbols you have. If the sequence 0,1,2,... is not really what you have in mind, try to post the real numbers which correspond to them.
 

mamfa

New Member
Joined
Jun 23, 2006
Messages
25
A* = 0
A = 1
B = 2
C = 3
D = 4
E = 5
F = 6
G = 7
U = 8

i have the letters/grades and i need to convert them to numbers in order to be able to do calculations with them?
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
A* = 0
A = 1
B = 2
C = 3
D = 4
E = 5
F = 6
G = 7
U = 8

i have the letters/grades and i need to convert them to numbers in order to be able to do calculations with them?

=MATCH(AB2,{"A*","A","B","C","D","E","F","G","U"},0)-1

does exactly that.
 

mamfa

New Member
Joined
Jun 23, 2006
Messages
25
thankyou i will now give that a try no doubt i'll be back on here again soon for more help!
 

Forum statistics

Threads
1,141,019
Messages
5,703,771
Members
421,315
Latest member
awaisnazir139

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
Top