# Need help with nested IF statement..

#### Galena1

##### Active Member
So I have this nested IF statement that compares dates in various fields:

=IF(AND(G67>=X\$2,G67<=Y\$2,L67>=X\$2,L67<=Y\$2),"",IF(AND(L67>X\$2,L67<=Y\$2),"Closed",""))

It works fine. Now, I want to add a condition where if it sees the word 'CAPA' in column B, to stop and return "" (blank) and not perform the date evaluation.
I added B121="CAPA","" to the front of the formula, but it's not working:

=IF(B121="CAPA","",AND(G121>=X\$2,G121<=Y\$2,L121>=X\$2,L121<=Y\$2),"",IF(AND(L121>X\$2,L121<=Y\$2),"Closed",""))

Anyone know how to add this condition so it works?

Thanks in advance for any help!

### Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

#### Snakehips

##### Well-known Member
Galena1,

Try......
=IF(B121="CAPA","",IF(AND(G121>=X\$2,G121<=Y\$2,L121>=X\$2,L121<=Y\$2),"",IF(AND(L121>X\$2,L121<=Y\$2),"Closed","")))

Hope that helps.

##### Well-known Member
You need another IF statement in front of the AND

/AJ

#### Galena1

##### Active Member
Galena1,

Try......
=IF(B121="CAPA","",IF(AND(G121>=X\$2,G121<=Y\$2,L121>=X\$2,L121<=Y\$2),"",IF(AND(L121>X\$2,L121<=Y\$2),"Closed","")))

Hope that helps.

And thanks everyone else for chiming in!

Replies
6
Views
1K
Replies
0
Views
580
Replies
2
Views
895
Replies
6
Views
1K
Replies
1
Views
1K

1,190,897
Messages
5,983,447
Members
439,843
Latest member
PlanetFitness

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