Conditional formatting of Cells based on date less a countdown.

KyleG

Well-known Member
Joined
Jun 12, 2004
Messages
629
Office Version
  1. 365
Platform
  1. Windows
Hi,

In the below image i have coloured the cells based on the current date.
What i want is for the sheet to colour code as appropriate when opened.
So Green if the cell is marked DONE
Red if today is >than the COO Date less the T-minus date (first three cells would go red if today is greater than the 5/8/2024, A8 starts going red if today is greater than 08/08/2024. eg. needs action
orange if today = the COO Date less the T-minus date is today.
No colouration if the above are not applicable

Happy if i have to populate the A column in full eg. multiple T-14s in A5, A6, and A7


1723163692280.png
 
Last edited by a moderator:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Also should note the number of stores numbers could be up to 15 so 30 across roughly.
 
Upvote 0
Try this. Copy to other columns as required. You will need to fill in column A.

Book1
ABCD
1
2
3
4COO Date19/08/2024
5T-14DONE
6T-14
7T-14
8T-11
9T-11
10T-10
11T-10
12T-7
13T-7
14T-7
15T-7
16
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C5:C15Expression=C5="DONE"textYES
C5:C15Expression=TODAY()>C$4-VALUE(MID($A5,FIND("-",$A5)+1,99))textNO
C5:C15Expression=TODAY()=C$4-VALUE(MID($A5,FIND("-",$A5)+1,99))textNO
 
Upvote 0
Another option that enables you to ..
  1. Apply the Conditional Formatting to a single area instead of copying column to column, and
  2. Leave the blank cells in column A rather than filling in the T values every row.
In my example below I selected D5:H15 and applied the CF shown.

24 08 09.xlsm
ABCDEFGH
1StoreStore 2Store 3
2
3
4COO Date19-Aug-2426-Aug-2402-Sep-24
5T-14DONE
6
7DONE
8T-11
9
10T-10DONE
11DONE
12T-44
13T-7
14
15T-0DONEDONE
CF
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D5:H15Expression=D5="DONE"textNO
D5:H15Expression=LET(L,LOOKUP("ZZ",$A$5:$A5),AND(D$1="",TODAY()>C$4+MID(L,FIND("-",L),99)))textNO
D5:H15Expression=LET(L,LOOKUP("ZZ",$A$5:$A5),AND(D$1="",TODAY()=C$4+MID(L,FIND("-",L),99)))textNO


If you apply the CF and it does not appear to be working correctly go to Conditional Formatting -> Manage rules ... and make sure the rules appear in the order shown below.
The order of the rules can be changed using the circled arrows.

1723187571672.png
 
Upvote 0
Solution
Thanks to you both. I have actioned as per Peter_SSs's response and it works great.
I want to make one change to the "Done" criteria. i want it to go green if it contains "Done". We have two scenarios when Done will also include additional information (name, text of a time). i cant figure out to get a wildcard character to be included.
 
Upvote 0
Change the 'DONE' CF formula to
Excel Formula:
=SEARCH("DONE",D5)

That is unless those columns in between could possibly also include a word containing the letters "done" (eg abandoned).
If that was possible then to stop them also going green use this for the CF formula for green
Excel Formula:
=AND(SEARCH("DONE",D5),D$1="")
 
Last edited:
Upvote 0
Good Morning,
Two things have come up with the red/orange formula.
1. When the Time minus cell is actually a Time plus cell the formula doesnt apply.
2. And me trying to understand what is happening in the formula as opposed to just taking your formula and applying it.

Could i please get assistance tweaking this for the T+ situations and if time allows walk me thru what the formula does.
As near as i can figure the formula more or less says look up a text (i assume thats what "ZZ" is saying) in the A cell and give it the name "L".
determine if it meets the > or = date find the - in the A column and return the aforementioned named "L" number, applying the formula and determining the colour of the cell based on the date.
I think the 99 is just a place holder number for the number of characters in the cell, it could equally be 20 or 200 as long as its not less than the number of characters in the cell.

I have not been able to determine what the "D$1" part of the formula is achieving. Where i THINK its not working for positive T values is the Find function part. I THINK i need some sort of OR argument but have not been able to string together anything that works.

your help as always is much appreciated.
 
Upvote 0
When the Time minus cell is actually a Time plus cell the formula doesnt apply.
So perhaps you could give a small set of sample data that had some "Time minus" cells and some "Time plus" cells and show/explain the expected results?
 
Upvote 0

Forum statistics

Threads
1,224,971
Messages
6,182,091
Members
453,088
Latest member
Chaoxite

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