Nested IF AND OR LEFT Statement Can't Wrap My Head Around

brenda1996

New Member
Joined
Aug 30, 2018
Messages
29
Hi all and thanks in advance for your help.

I am working a simple spreadsheet I can't wrap my head around a formula to return either OK or NOT OK.

The formula is =IF(AND(D2="C00"),OR(AND(LEFT(E2,1)="C"),OR(AND(LEFT(F2,1)="C"),"OK","NOT OKAY")))

I would like to Search for Column D2 C00 and in E2 and F2 any word that begins with a C would return a value of OK, else NOT OKAY.

This formula would then carry down to other lines.

I am missing something simple. The formula works but returns either a TRUE or FALSE instead of and OK or NOT OKAY.

Once that formula works I want to add to it to also return a OK value if anything in Column D begins with a R by using the LEFT(D2,1="R") statement but baby steps to get there. :)

If anyone can see what I am doing wrong with the formula above I sure would appreciate some guidance.

Kind regards and thanks in advance!

Brenda
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
How about
Excel Formula:
=IF(AND(D2="C00",OR(LEFT(E2)="C",LEFT(F2)="C")),"OK","Not Ok")
 
Upvote 0
I think you mean:

Excel Formula:
=IF(OR(LEFT(D2,1)="R",AND(D2="C00",OR(LEFT(E2,1)="C",LEFT(F2,1)="C"))),"OK","NOT OKAY")
 
Upvote 0
Solution
If both E2 & F2 are blank then that formula will return Not Ok.

However I missed the 2nd part of your question, which Rory has dealt with, so try that.
 
Upvote 0
I think you mean:

Excel Formula:
=IF(OR(LEFT(D2,1)="R",AND(D2="C00",OR(LEFT(E2,1)="C",LEFT(F2,1)="C"))),"OK","NOT OKAY")
Hi and thanks for your reply. That did not work, getting OK with all cells blank, D2, E2 and F2.Brenda
 
Upvote 0
Hi and thanks for your reply. That did not work, getting OK with all cells blank, D2, E2 and F2.Brenda
I am sorry, YES it did work! I put the formula in line 4 as copied and forgot to change the formula. Thank you so much for your help. Looking at this it makes sense now! Yay!
 
Upvote 0
Hi and thanks for your reply. That did not work, getting OK with E2 and F3 blank, that should ne NOT OK. Brenda
I am sorry, YES that also works but without the "R" portion, it did work! I put the formula in line 6 as copied and forgot to change the formula. Thank you so much for your help. Looking at this it makes sense now! Yay!
 
Upvote 0
If both E2 & F2 are blank then that formula will return Not Ok.

However I missed the 2nd part of your question, which Rory has dealt with, so try that.
Yes Rory's formula works, thank you both! Looking at the formula makes perfect sense now. Thank you BOTH!! Brenda
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,882
Members
449,097
Latest member
dbomb1414

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
Back
Top