How to Highlight Next N Working Days in Google Sheets

Published on

You can use a combination formula with WORKDAY.INTL as the key function to highlight the next N working days from a specific date in Google Sheets.

This formula requires you to specify:

  1. The number of business days to highlight.
  2. The weekends.
  3. Any specific holidays to exclude.

These details will be incorporated into the formula, as explained below.

How Highlighting Next N Working Days Is Useful

Sometimes, you may need to commit to clients or stakeholders that you’ll complete tasks within the next 3, 7, or 10 working days from a specific date.

In such cases, you might want to highlight rows in your dataset where the task dates fall within the next N working days. Working days exclude weekends and holidays, making this functionality especially useful for accurate scheduling.

Example: Highlighting Next N Working Days

Assume the list of dates is in column A2:A.

  1. Enter the specific start date in D2. This could be =TODAY() or any other date.
  2. In E2, input the number of business days to highlight (e.g., 5).
  3. Use F2:F to specify holidays to exclude from the highlighting.
Example of Highlighting the Next N Working Days in Google Sheets

Now, use the following custom formula in conditional formatting:

=AND(
   ISBETWEEN(
      A2, 
      WORKDAY.INTL($D$2, 1, "0000011", TOCOL($F$2:$F, 1)), 
      WORKDAY.INTL($D$2, $E$2, "0000011", TOCOL($F$2:$F, 1))
   ), 
   NOT(ISNUMBER(XMATCH(WEEKDAY(A2, 2), {6; 7}))),
   NOT(ISNUMBER(XMATCH(A2, TOCOL($F$2:$F, 1))))
)

This formula highlights the next 5 business days from the date in D2, excluding the holidays in F2:F. Here, “0000011” defines Saturday and Sunday as weekends.

Applying the Rule

  • Select the range A2:A (the dates to be highlighted).
  • Go to Format > Conditional formatting.
  • Under Format rules, choose Custom formula is and paste the formula above.
  • Select your preferred formatting style and click Done.

Now, the specified range will highlight the next N working days.

Customizing Weekends in the Formula

The formula uses a string to specify weekends within the WORKDAY.INTL function. The string contains seven characters where 0 represents a workday and 1 represents a weekend. For example:

  • "0000011": Saturday and Sunday as weekends.
  • "0000110": Friday and Saturday as weekends.

If you change the weekend string, remember to update:

  1. Both occurrences of WORKDAY.INTL in the formula.
  2. The array constants {6; 7} for the weekend days. For example, if your weekends are Friday and Saturday, replace it with {5; 6}.

Here’s the updated formula for Friday and Saturday weekends:

=AND(
   ISBETWEEN(
      A2, 
      WORKDAY.INTL($D$2, 1, "0000110", TOCOL($F$2:$F, 1)), 
      WORKDAY.INTL($D$2, $E$2, "0000110", TOCOL($F$2:$F, 1))
   ), 
   NOT(ISNUMBER(XMATCH(WEEKDAY(A2, 2), {5; 6}))),
   NOT(ISNUMBER(XMATCH(A2, TOCOL($F$2:$F, 1))))
)

How the Formula Works

Logical Expression 1:

ISBETWEEN(A2, next_n_start, next_n_end)
  • WORKDAY.INTL($D$2, 1, "0000011", TOCOL($F$2:$F, 1)): Calculates the start date of the next N working days.
  • WORKDAY.INTL($D$2, $E$2, "0000011", TOCOL($F$2:$F, 1)): Calculates the end date of the next N working days.
  • ISBETWEEN checks if the date in A2 falls within this range.

Logical Expression 2:

NOT(ISNUMBER(XMATCH(WEEKDAY(A2, 2), {6; 7})))

Returns TRUE if the date in A2 is not a weekend.

Logical Expression 3:

NOT(ISNUMBER(XMATCH(A2, TOCOL($F$2:$F, 1))))

Returns TRUE if the date in A2 is not a holiday.

If all conditions are TRUE, the formula highlights the cell.

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

More like this

Pivot Table Formatting, Output & Special Behavior in Google Sheets

Pivot Tables in Google Sheets are powerful—but they can get tricky once you move...

Pivot Table Calculations & Advanced Metrics in Google Sheets

When it comes to built-in tools for data analysis and visualization in Google Sheets,...

Google Sheets Pivot Table Tutorial: Basics, Setup, and Date Grouping

The easiest way to summarize, analyze, and report data in Google Sheets is by...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.