# to many ifs

#### mamfa

##### New Member
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

To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
=MATCH(AB2,{"A","B","C","D","E","F","G","U"},0)

=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.

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?????

=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

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

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

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.

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?

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.

thankyou i will now give that a try no doubt i'll be back on here again soon for more help!

Replies
0
Views
673
Replies
8
Views
772
Replies
4
Views
872
Replies
5
Views
118
Replies
4
Views
281

1,217,505
Messages
6,137,030
Members
450,041
Latest member
MM2024

### 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.

### Which adblocker are you using?

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

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