Conditional formatting

eabaker64

New Member
Joined
Jul 1, 2024
Messages
35
Office Version
  1. 365
Platform
  1. Windows
I have looked online to see if I could get this figured out on my own, but I have been unsuccessful in finding exactly what I am looking for. I have a tracking spreadsheet. Column A contains a date that a list was created, Column B will have a date entered for when the list was sent to the provider. I have it formatted so if there is no date in column A, both columns have no formatting colors. If Column A has a date, I want column B to show red fill/red font if 4 working days (excluding holidays) have passed since the date in Column A. I want column B to show red even if it is blank (no date) but it is past the 4 working days. If it is less than 4 working days, I want column B to show green fill/font, whether column B has a date in it or not.

I was able to get one formula to work, but it does not look at workdays, and I hadn't decided to exclude holidays at that point. My holidays are listed in cells B34:B54

What I have so far is:
Formula: =IF(TODAY()<$B$2+3,1,0) Green fill with green font
Formula: =IF($B$2<TODAY()+4,1,0) Red fill with red font
Formula: =$B$2="" No formatting

I know that I need the WORKDAY function in there somewhere, and I believe I need the TODAY function in there as well, but I have no idea of what should go where. Any help is greatly appreciated!!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
See if this works for you:
Book1
ABCDE
1Date1Date2HolidaysDate
211/14/2411/27/24New Year's Day (January 1)1/1/24
311/8/24Juneteenth National Independence Day (June 19)6/19/24
411/12/24Independence Day (July 4)7/4/24
5Veterans Day (November 11)11/11/24
6Thanksgiving Day (Fourth Thursday in November)11/25/24
7Christmas Day (December 25)12/25/24
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B5Expression=(A2<>"")*(TODAY()-WORKDAY.INTL(A2,4,1,$E$2:$E$7)>=4)textYES
B2:B5Expression=(A2<>"")*(NETWORKDAYS.INTL(A2,B2,1,$E$2:$E$7)>=4)textNO
B2:B4Expression=(A2<>"")*(TODAY()-WORKDAY.INTL(A2,4,1,$E$2:$E$7)<4)textNO
 
Upvote 0
See if this works for you:
Book1
ABCDE
1Date1Date2HolidaysDate
211/14/2411/27/24New Year's Day (January 1)1/1/24
311/8/24Juneteenth National Independence Day (June 19)6/19/24
411/12/24Independence Day (July 4)7/4/24
5Veterans Day (November 11)11/11/24
6Thanksgiving Day (Fourth Thursday in November)11/25/24
7Christmas Day (December 25)12/25/24
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B5Expression=(A2<>"")*(TODAY()-WORKDAY.INTL(A2,4,1,$E$2:$E$7)>=4)textYES
B2:B5Expression=(A2<>"")*(NETWORKDAYS.INTL(A2,B2,1,$E$2:$E$7)>=4)textNO
B2:B4Expression=(A2<>"")*(TODAY()-WORKDAY.INTL(A2,4,1,$E$2:$E$7)<4)textNO
I used the formula you suggested. The only thing I am not sure about is if the date entered in A2 is 11/12/2024, I would think it should show as red, but it is showing green. Even if it doesn't count the day of 11/12/24, starting with 11/13/24, 4 working days would be 11/18/24. With today being 11/19/24, shouldn't the cell be red?
 
Upvote 0
Flaws in my logic. Try:
Book1
ABCDE
1Date1Date2HolidaysDate
211/14/2411/21/24New Year's Day (January 1)1/1/24
311/8/24Juneteenth National Independence Day (June 19)6/19/24
411/12/24Independence Day (July 4)7/4/24
511/18/24Veterans Day (November 11)11/11/24
6Thanksgiving Day (Fourth Thursday in November)11/25/24
7Christmas Day (December 25)12/25/24
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B5Expression=(A2<>"")*(TODAY()>=WORKDAY.INTL(A2,4,1,$E$2:$E$7))textNO
B2:B5Expression=(A2<>"")*(NETWORKDAYS.INTL(A2,B2,1,$E$2:$E$7)>=4)textNO
B2:B5Expression=(A2<>"")*(TODAY()<WORKDAY.INTL(A2,4,1,$E$2:$E$7))textYES
 
Upvote 0
Solution
Just wanted to make an educational comment about the formulas you used initially, like this one:
Excel Formula:
=IF(TODAY()<$B$2+3,1,0)

Conditional Formatting uses Boolean values (TRUE/FALSE) in determining whether or not to perform the action.
So it is not necessary to use an IF statement - just write your formula so it returns a boolean value.
For your formula above, you just need the part in the first argument of your IF function, i.e.
Excel Formula:
=TODAY()<$B$2

That is all you need to write! No IF formulas necessary!
 
Upvote 0
Flaws in my logic. Try:
Book1
ABCDE
1Date1Date2HolidaysDate
211/14/2411/21/24New Year's Day (January 1)1/1/24
311/8/24Juneteenth National Independence Day (June 19)6/19/24
411/12/24Independence Day (July 4)7/4/24
511/18/24Veterans Day (November 11)11/11/24
6Thanksgiving Day (Fourth Thursday in November)11/25/24
7Christmas Day (December 25)12/25/24
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B5Expression=(A2<>"")*(TODAY()>=WORKDAY.INTL(A2,4,1,$E$2:$E$7))textNO
B2:B5Expression=(A2<>"")*(NETWORKDAYS.INTL(A2,B2,1,$E$2:$E$7)>=4)textNO
B2:B5Expression=(A2<>"")*(TODAY()<WORKDAY.INTL(A2,4,1,$E$2:$E$7))textYES
PERFECT!!! And thank you for the other information about not needing the IF function. So much appreciated. And I never would have come up with the formula for the red and green cells, you have saved me SO much time.
 
Upvote 0
eabaker64,

Please Note: In the future, when marking a post as the solution, please mark the post that contains the solution (not your own post acknowledging that some other post was the solution).
When a post is marked as the solution, it is then shown right underneath the original question so people viewing the question can easily see the question and solution in a single quick glance without having to hunt through all the posts.

I have updated this thread for you.
 
Upvote 0
@Cubist I swear the other day when I tried this formula, it worked perfect, but now I am having problems with it. If the cells in B2 are blank, with no dates, the conditional formatting works fine. But for this spreadsheet, I am having to go back and enter past dates. For A2, I have a date of 9/20/24. B2, without a date entered, shows red, which it should. But if I enter a date in B2 that is 9/24/24 (within the three working days, excluding holidays), it still shows red and it should show green. The attached pic is actually my second attempt today. My first attempt had all the same information there, but the conditional formatting was not working at all. And at one point, I changed a date on A4 and it changed the fill color on B3...have no idea of how. My computer is possessed, or at least Excel seems to be. Thanks for taking a look at this for me.
 

Attachments

  • Cond 1.png
    Cond 1.png
    38.7 KB · Views: 3
Upvote 0
@Cubist I swear the other day when I tried this formula, it worked perfect, but now I am having problems with it. If the cells in B2 are blank, with no dates, the conditional formatting works fine. But for this spreadsheet, I am having to go back and enter past dates. For A2, I have a date of 9/20/24. B2, without a date entered, shows red, which it should. But if I enter a date in B2 that is 9/24/24 (within the three working days, excluding holidays), it still shows red and it should show green. The attached pic is actually my second attempt today. My first attempt had all the same information there, but the conditional formatting was not working at all. And at one point, I changed a date on A4 and it changed the fill color on B3...have no idea of how. My computer is possessed, or at least Excel seems to be. Thanks for taking a look at this for me.
Actually nevermind. I got it figured out. Sorry.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,107
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