Creating a nested IF statement for mulitple expiration dates

tstage

New Member
Joined
May 2, 2018
Messages
9
Greetings -

I am attempting to create a working inventory that will automatically detect expiration dates in three separate columns (which I'll call Column A, Column B, and Column C) and place the outcome ("Expired") in Column D. What I want the formula to do is to look at Column C first* to see if there is a date present. If there isn't, I then want it to look at Column B. If Column B is blank then I want it to look at Column A. If Column A, B, and C are all blank I want it to return a blank cell in Column D.

Anytime an expiration date is exceeded, the word "Expired" will automatically become visible in Column D. This will alert the user that the product is expired and should be moved to a quarantined area, which will be automatically noted in another column (E) using the following simple IF statement:

=IF([Column D]="Expired","Quarantine","")

I can create a formula to work for one column but three columns is alluding me. Here's the IF Statement I came up with for one column (A), which works for any date prior to "Today":

=IF(OR(ISBLANK([Column A]),[Column A]<=TODAY()),"","Expired")

What I'm guessing I'm looking for is a nested IF statement that will cover the following six scenarios and properly display the outcome in Column D:


  • Column A expiration date is not expired - Column D remains blank
  • Column A expiration date is expired - Column D displays "Expired"
  • Column A expiration date is expired but Column B expiration date is not expired - Column D remains blank
  • Column A & Column B expiration date is expired - Column D displays "Expired"
  • Column A & Column B expiration date is expired but Column C expiration date is not expired - Column D remains blank
  • Column A, Column B, and Column C expiration date is expired - Column D displays "Expired"

So, if Column B has an expiration date, Column D would need to ignore the expired date in Column A and only respond to the unexpired or expired date in Column B. The same would be true for Column A & B when Column C is occupied.

I hope that all makes sense. I appreciate any suggestions or tips any of you might be able to give me.

Thanks,

Tom
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Does this work?

=IF(C1>TODAY(),"Expired",IF(B1>TODAY(),"Expired",IF(A1>TODAY(),"Expired","")))
 
Upvote 0
Hi Special-K99,

Thanks for the reply. Unfortunately, the formula doesn't work. I plugged it into Column D. Even if I place a future date in the same row of either Column B or Column C, "Expired" remains in Column D. What I want to achieve is for Column D to reflect the status of the most recent date - i.e. albeit Column A, B, or C - and whether it is expired or unexpired.

Tom
 
Upvote 0
Try this

=IF(A1&B1&C1="","",IF(AND(C1 < TODAY(),C1 <> ""),"Expired",IF(AND(B1 < TODAY(),B1 <> ""),"Expired",IF(AND(A1 < TODAY(),A1 <> ""),"Expired",""))))

or this

=IF(A1&B1&C1="","",IF(MAX(A1,B1,C1) < TODAY(),"Expired",""))
 
Last edited:
Upvote 0
Special-K99,

Thanks. While I didn't use your 2nd formula, your 1st formula actually helped me discover an IF(OR statement that seems to work:

=IF(OR(C1>=TODAY(),B1>=TODAY(),A1>=TODAY()),"","Expired")

When I substitute expired and unexpired dates in any of the columns, "Expired" displays or disappears as it should - Woohoo!

Thanks for the "seed" to help me discover the correct formula. =O)

Tom
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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