Conditional Formatting/Formula

Arts

Well-known Member
Joined
Sep 28, 2007
Messages
765
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all

I have two dates, Due Date and Actual Dates of which I am doing a calculation of to get the number of days between the actual date and due date. What I was hoping to do was use conditional formatting to colour the cell different colours depending on how late or early the date difference was. Now the issue I seem to have is that I am trying to highlight anything that is over a certain time by extracting just the number from the Date Difference Column.
so anything > refers to Days Late, < Days Early

Red: >28 <-28 days (so anything more than -28 days Early as Red)
Amber: >14 but less than 28, <-28 (so anything upto -28 days Early as Amber)
Green: <14 <-14 (so anything upto -14 days Early as Green)


Due DateActual End DateDate Difference
30/08/23​
02/09/23​
3 Days late
14/07/22​
21/04/22​
-84 Days Early
14/04/23​
20/03/23​
-25 Days Early
14/04/23​
20/03/23​
-25 Days Early

Within the conditional formatting, I have done (shown below) this seems to highlight the 3 days late as Red but should be Green. I maybe completely on the wrong path and there could be an easier way to extract the number from the text within conditional formatting, as always any help is appreciated.

1693494428935.png
 
You will need three rules, one for each color.

Red formula:
Excel Formula:
=ABS(LEFT(M11,SEARCH" ",M11-1)*1)=>28

Amber formula:
Excel Formula:
=AND(ABS(LEFT(M11,SEARCH" ",M11-1)*1)>14,ABS(LEFT(M11,SEARCH" ",M11-1)*1)<28)

Green formula:
Excel Formula:
=ABS(LEFT(M11,SEARCH" ",M11-1)*1)<=14

Note: that you may need to edit the formula slightly depending on what color you want EXACTLY 14 and 28 days to me (i.e. change ">" to ">=' and/or "<" to "<=" in the appropriate rules).
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
You will need three rules, one for each color.

Red formula:
Excel Formula:
=ABS(LEFT(M11,SEARCH" ",M11-1)*1)=>28

Amber formula:
Excel Formula:
=AND(ABS(LEFT(M11,SEARCH" ",M11-1)*1)>14,ABS(LEFT(M11,SEARCH" ",M11-1)*1)<28)

Green formula:
Excel Formula:
=ABS(LEFT(M11,SEARCH" ",M11-1)*1)<=14

Note: that you may need to edit the formula slightly depending on what color you want EXACTLY 14 and 28 days to me (i.e. change ">" to ">=' and/or "<" to "<=" in the appropriate rules).

Thank you so much for this Joe did exactly what I needed! (apologies for the delayed response people seem to be working on a Friday today and it seems to all be coming my way)

I started with the RED condition first and it didn't seem to want to accept it but then switched the "=>28" to ">=28" which seemed to do the trick!

It doesn't allow me to mark two responses as a solution so apologies if this may affect your status amongst the MVP elites, but on your say so happy to remove the first solution and mark it against yours.... ;)
 
Upvote 0
It doesn't allow me to mark two responses as a solution so apologies if this may affect your status amongst the MVP elites, but on your say so happy to remove the first solution and mark it against yours....
No worries. It doesn't affect anything, other than counts (which are interesting, but not really used for anything).

Glad we were able to help!
 
Upvote 0

Forum statistics

Threads
1,215,068
Messages
6,122,950
Members
449,095
Latest member
nmaske

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