Solved Multiple 'IF' conditions

Microsoft Excel 2010 - license
December 29, 2011 at 09:28:18
Specs: Windows 7, E8400/4GB
So I have been asked to make a spreadsheet for my lab that keeps track of our reagents and when they are opened, tested, and expire.

I want to make a single column that will check the dates in previous columns to give a final 'OK' or 'Do Not Use'.

So far I am only able to use one 'IF' statement, I can't seem to get multiple 'IF' statements to work.

Right now, I am using "=IF(F2>=TODAY(),"OK","DO NOT USE")"

F2 is the expiration date, so this is checking to make sure that the product is not expired. However, I also need to check that the product has been tested before we use it. Therefore, I need another 'IF' statement to test that there is a date tested in G2 (i.e. that it is not blank).

So I *think* I need a nested IF statement that will check both of these conditions, and as long as the conditions are true (that the expiration date is >=Today, and that G3 is not blank), it will return simply as 'OK', or if false as 'Do Not Use'.

Thanks for any help/advice!

See More: Multiple IF conditions

Report •

December 29, 2011 at 10:12:27
✔ Best Answer
It could be done with a Nested IF but I think an IF AND fucntion would be more efficient and easier to understand.

For the AND function to return TRUE, all of the logicals that you are checking must be TRUE.

=IF(AND(G2<>"", F2>=TODAY()),"OK", "DO NOT USE")

If either (or both) of the logicals are FALSE, the AND will return FALSE and the value_if_false argument will be returned.

If you really want a Nested IF, you'd have to check both conditions in sequence and have two value_if_false arguments to handle either of the conditions being FALSE.

=IF( F2>=TODAY(),IF(G2<>"","OK", "DO NOT USE"),"DO NOT USE")

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •

December 29, 2011 at 10:18:55
Thanks DerbyDad, that cleared it up for me. I think I was trying to do a mixture of the two, and was really confusing myself.

The AND statement works great, and I can modify it if I ever need to. Out of curiosity, how many 'logicals' can I ask it to check for?

Again, thanks alot for the help!

Report •

December 29, 2011 at 13:03:07
I think that you can use up to 255 logicals but I'm not about to test it to find out.

I'll leave that up to you. ;-)

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •

Related Solutions

Ask Question