# Trouble with an IF statement

#### CSyx

##### Board Regular
Hello all,

Using Excel 2007

The current formula tests an employee date of hire (P10) for eligibility of benefits and is working perfrectly if I no not have any rehired employees:

=IF(AND(Q10="",S10="",\$B\$3-P10>=\$AO\$1),\$AO\$2,"")

I would like to add to the formula stating if Q10 (rehire date) is NOT blank, S10="",\$B\$3-Q10>=\$AO\$1)\$AO\$2,"")

Just can't seem to get this figured out.

Thanks for the help.

### 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,)
Perhaps change
Q10=""
to
Q10<>""

Well... you've already got the false set as "". So why don't you add two ifs together?

=IF(AND(Q10="",S10="",\$B\$3-P10>=\$AO\$1),\$AO\$2,"")+IF(AND(Q10<>"",S10="",\$B\$3-P10>=\$AO\$1),\$AO\$2,"")

Since you're returning the same result regardless of the value in Q10, drop that check altogether:

=IF(AND(S10="",\$B\$3-P10>=\$AO\$1),\$AO\$2,"")

Thanks for all the help! I used the information everyone posted to get:

=IF(AND(Q45="",S45="",\$B\$3-P45>=\$AO\$1),\$AO\$2,IF(AND(Q45<>"",S45="",\$B\$3-P45>=\$AO\$1),\$AO\$2,""))

And this solved my problem. The support here is outstanding!

But why would you do the second check? The only difference between the two is whether S45 is blank or not, the rest of the comparisons are identical, so the initial check of Q45 is not necessary:

=IF(AND(S45="",\$B\$3-P45>=\$AO\$1),\$AO\$2,"")

should accomplish the same thing.

Replies
3
Views
631
Replies
1
Views
179
Replies
5
Views
145
Replies
8
Views
307
Replies
0
Views
265

1,196,078
Messages
6,013,290
Members
441,760
Latest member
Sharina

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