# IF statement using multiple cells. Result should consider whether cells are blank

1. ## IF statement using multiple cells. Result should consider whether cells are blank

I have an excel worksheet with 3 columns A, B and C.
Columns A and B may or may not contain a value and Column C is populated with an IF statement which evaluates the values in Columns A and B
and then populates C with text based on the results of the IF. A sample worksheet is attached which shows the details.

What I am trying to accomplish is this:

1) If Columns A and B both contain a value and those values are the same, the IF statement should populate Column C with "OK".
2) If Columns A and B both contain a value and those values are the same after the UPPER function is applied to both values, the IF statement should populate Column C with "OK".
3) If Columns A and B both contain a value but those values are not the same, the IF statement should populate Column C with "Review".

The IF statement I am currently using in Column C is working correctly for these 3 scenarios.
=IF(AND(NOT(ISBLANK(A2)),NOT(ISBLANK(B2))), IF(UPPER(A2) = UPPER(B2), "OK","Review"),"")

Where it starts to not work correctly is when either Column A and/or B does not contain a value.
Currently if either A or B do not contain a value, Column C is blank and I want it to contain "Review"

So I need to fix the IF statement to work for the following scenarios as well.

4) If Column A or B do not contain a value, the IF statement should populate Column C with "Review".
5) If Column A and B are both blank, Column C should also be blank

Any help or suggestions would be greatly appreciated.

Thanks.  Register To Reply

2. ## Re: IF statement using multiple cells. Result should consider whether cells are blank

Hello and welcome to the forum.

Try this in C2:

=IF(A2="",IF(B2<>"","Review",""),IF(A2=B2,"OK","Review"))  Register To Reply

3. ## Re: IF statement using multiple cells. Result should consider whether cells are blank

Maybe: =IF(AND(A2="",B2="",),"",IF(OR(AND(A2="",B2<>""),AND(A2<>"",B2="")),"Review",IF(AND(NOT(ISBLANK(A2)),NOT(ISBLANK(B2))),IF(UPPER(A2)=UPPER(B2),"OK","Review"),"")))  Register To Reply

4. ## Re: IF statement using multiple cells. Result should consider whether cells are blank

Welcome to the forum. Try this:

=IF(AND(A2="",B2<>""),"Review",IF(AND(A2="",B2=""),"",IF(A3=B3,"OK","NOT OK")))

Excel doesn't care about the case of text it is comparing.  Register To Reply

5. ## Re: IF statement using multiple cells. Result should consider whether cells are blank

63falcondude,

Works perfectly, thanks so much!
I thought the answer was going to be more complicated than that.  Register To Reply

6. ## Re: IF statement using multiple cells. Result should consider whether cells are blank

Which one? You got three options!  Register To Reply

7. ## Re: IF statement using multiple cells. Result should consider whether cells are blank

You're welcome. Happy to help.

Thanks for the rep!  Register To Reply

8. ## Re: IF statement using multiple cells. Result should consider whether cells are blank

AliGW,

Sorry, I just updated my reply and will mark the thread as Solved.

Thanks.  Register To Reply

9. ## Re: IF statement using multiple cells. Result should consider whether cells are blank

AliGW,

I didn't know that Excel doesn't care about the case of text when doing a compare.
I thought I would need to use the UPPER function first.

Good to know for the future, thanks.  Register To Reply

10. ## Re: IF statement using multiple cells. Result should consider whether cells are blank

Glad to have helped.   Register To Reply

There are currently 1 users browsing this thread. (0 members and 1 guests) 