nested IF

ritters

New Member
Joined
Jun 16, 2010
Messages
8
I want to try an nest an IF so i can have several conditions on a cell.

is there a formula possible for the below assumptions?

((IFA2=9 or 10, then = 1, IF(A2=7,8, or 12, then =2, IF(A2=3,or 4, then =3, IF(A2=5,6, or 13, then = 4))

Thanks
 

Some videos you may like

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,730
Office Version
  1. 365
Platform
  1. Windows
Nested IF for below would be:
Rich (BB code):
=IF(OR(A2=9, A2=10),1,IF(OR(A2=7,A2=8,A2=12),2,IF(OR(A2=3,A2=4),3,IF(OR(A2=5,A2=6,A2=13),4,"Default"))))
Default is when nothing matches, though you can change that to anything you want.
However, I'd be more tempted to create a table with numbers 1 to 13 in one column and the required value next to them, e.g.

1 Default
2 Default
3 3
4 3
5 4
6 4
7 2
8 2
9 1
10 1
11 Default
12 2
13 4

And then use a VLOOKUP formula based on this table instead of a nested IF formula. It would make changing values easier too.
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,203
I want to try an nest an IF so i can have several conditions on a cell.

is there a formula possible for the below assumptions?

((IFA2=9 or 10, then = 1, IF(A2=7,8, or 12, then =2, IF(A2=3,or 4, then =3, IF(A2=5,6, or 13, then = 4))

Thanks

Try something like...

=LOOKUP(A2,{0,3,5,7,9,11,12,13},{"?",3,4,2,1,"??",2,4})
 

Watch MrExcel Video

Forum statistics

Threads
1,127,935
Messages
5,627,705
Members
416,268
Latest member
zRGZgDNnmaPhepwviEou

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