If function with 3 conditions

CarolB

New Member
Joined
Apr 25, 2019
Messages
6
Hi

I wanted a formula and conditioning formatting for 3 conditions,

If training is past expiry date to go red and say expired, If not due stay green and say not due. if 30 days or less to go say - 30 day or less and turn orange.

Thanks in advance and any help will be appreciated.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
where is your reference date

you might start with

=IF(C2>TODAY(),"Not Due",IF(C2 < TODAY(),"Expired",""))<today(),"expired",""))

as Formula, you can then add conditional format to the Expired and Not Due Cells</today(),"expired",""))
 
Last edited:
Upvote 0
Hi

Is it not possible t have a 3rd condition such as if its 30 day or less - state due in30 days or less.

thank you
 
Upvote 0
Try this:
Code:
=IF(TODAY()>C2,"Expired",IF(C2-TODAY()<=30,"30 days or less","Not due"))
 
Last edited:
Upvote 0
For Conditional Formatting, your three CF formula rules would look like:

Rule 1
=C2 < TODAY()

Format red

Rule 2
=AND(C2 >= TODAY(), C2 - TODAY() < = 30)

Format orange

Rule 3
=C2 - TODAY() > 30

Format green
 
Last edited:
Upvote 0
Hi

Thank you very much, that I exactly what I required. I had two conditions working but not all three
 
Upvote 0
You are welcome. If you want to read up more on nesting IF statements, see here:
https://support.office.com/en-us/article/if-function-%E2%80%93-nested-formulas-and-avoiding-pitfalls-0b22ff44-f149-44ba-aeb5-4ef99da241c8

 
Upvote 0
Hi

I now have two additional scenarios to complicate matters, can I add something if cells are blank or that they have N/A in addition to the ones you sorted above.

Many Thanks
 
Upvote 0
is it possible to now add 2 further conditions. I.E Cell is going to be blank or have N/A. Then make the answer to both N/A.

Thanks in advance
Many Thanks
 
Upvote 0
Sure, just nest another level in, i.e.
Code:
=IF(OR(ISNA(C2),C2=""),"N/A",[COLOR=#333333]IF(TODAY()>C2,"Expired",IF(C2-TODAY()<=30,"30 days or less","Not due")[/COLOR])
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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