# Ifs, ANDs, ORs, with text strings, grrrrrrrrr.

#### carabale

##### Board Regular
I have this formula, which works fine.

=IF(OR(AA3="",AB3=""),"N",IF(AND(AL3<>"",AL3>TODAY()+365),"N",IF(AND(AA3<>"",AB3<>""),"Y")))

However, I need it now to indicate "N" if the inmate is a Sex or Career Offender; so I tried this but is not working:

=IF(ISERROR(FIND("SEX",P2)),IF(ISERROR(FIND("CAREER",P2)),"N",IF(OR(AA2="",AB2=""),"N",IF(AND(AL2<>"",AL2>TODAY()+365),"N",IF(AND(AA2<>"",AB2<>""),"Y")))))

I get a "FALSE" when it encounter the string.

I put the formula togethe from bits and pieces of information; so I know is incomplete or out of order. If It could be simplified would be even greater.

### Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

#### Andrew Poulsom

##### MrExcel MVP
Is it?

=IF(OR(ISNUMBER(SEARCH("SEX",P3)),ISNUMBER(SEARCH("CAREER",P3)),AA3="",AB3=""),"N",IF(AND(AL3<>"",AL3>TODAY()+365),"N",IF(AND(AA3<>"",AB3<>""),"Y")))

#### Scott Huish

##### MrExcel MVP
Does this work for you?

=IF(OR(SUM(COUNTIF(P2,{"*CAREER*","*SEX*"})),AA2="",AB2="",AND(AL2>TODAY()+365)),"N","Y")

Last edited:

#### carabale

##### Board Regular
Thank you, thank you, thank you. I was just asked for this report. I thought I had time to figure it out, but I am so glad you all replied so quickly. Saved me from going through 1,300 rows.

I used Mr. Poulsom and it worked marvelous. I have not tried Huish's yet.

But thank you both...

Replies
3
Views
314
Replies
2
Views
556
Replies
1
Views
263
Replies
12
Views
1K
Replies
1
Views
305

1,196,016
Messages
6,012,863
Members
441,737
Latest member
bijayche

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