# Nested IF Statement

#### toleafs

##### Active Member
I've been looking for this on the message board but no luck. Any help would be GREATLY appreciated... I am trying to write a statement that will give me a result based on the value in cell I2.
For instance, if cell I2 was 4 - result PH; but if cell I2 was 9 - result is EH.

IF(I2>=0, I2<=6,"PH", IF(I2>7, I2<=10, "EH"))

hope this makes sense.
Thanks

### Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

#### VoG

##### Legend
Try

=IF(AND(I2>=0, I2<=6),"PH", IF(AND(I2>7, I2<=10), "EH"))

#### texasalynn

##### Well-known Member
You would want to put the formula in that cell
=IF(and(I2>=0, I2<=6),"PH", IF(and(I2>7, I2<=10), "EH",""))

edit: should that be >=7 not >7

Last edited:

#### Scott Huish

##### MrExcel MVP
Maybe:

=LOOKUP(I2,{0,"PH";7,"EH";11,""})

#### toleafs

##### Active Member

Question,
If I2 is a formula, this doesn't seem to work? Any suggestions?

#### texasalynn

##### Well-known Member
post a sample of your data. Formulas won't matter

#### toleafs

##### Active Member

I am using: =IF(AND(I2>=0, I2<=6),"PH", IF(AND(I2>7, I2<=10), "EH")) , it returns FALSE.

....I2 Contains the formula: =Right(H2,2)

#### lenze

##### Legend
The RIGHT function returns a Text string. Change your formula to
Code:
``=RIGHT(H2,2)*1``
lenze

#### toleafs

##### Active Member
Thank You, it works great

#### toleafs

##### Active Member
I ran into another issue....I have 7 conditions to meet and excel does not allow me to nest 7 IF statements. Any ideas?

Replies
8
Views
698
Replies
7
Views
459
Replies
6
Views
194
Replies
3
Views
202
Replies
2
Views
592

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,163,467
Messages
5,831,802
Members
430,087
Latest member
meagerd

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