Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Conditional Formatting New Rule with Formulas in Excel
  • How to Create Gantt Chart in Excel
  • How To Load Analysis ToolPak in Excel
  • How to calculate current stock or inventory in Excel
  • Conditional Formatting Icon Sets Examples in Excel

References

  • How to get last column number in range in Excel
  • How to get address of last cell in range in Excel
  • Two-column Lookup in Excel
  • MATCH function: Description, Usage, Syntax, Examples and Explanation
  • Excel Advanced Lookup using Index and Match Functions

Data Validations

  • Excel Data validation must contain specific text
  • Prevent invalid data entering in specific cells
  • How To Create Drop-down List in Excel
  • Excel Data validation whole percentage only
  • Excel Data validation exists in list

Conditional formatting gantt chart weekends in Excel

by

This tutorial shows how to work Conditional formatting gantt chart weekends in Excel using the example below;

Formula

=WEEKDAY(date,2)>5

Explanation

To build a Gantt chart with weekends shaded, you can use Conditional Formatting with a formula based on the weekday function.In the example shown, the formula applied the calendar, starting at D4, is:

=WEEKDAY(D$4,2)>5

Note: this formula deals with weekend shading only. To see how to build the date bars with conditional formatting, see this article.

How this formula works

The key to this approach is the calendar header (row 4), which is just a series of valid dates, formatted with the custom number format “d”.  With a hardcoded date in D4, you can use =D4+1 to populate the calendar. This allows you to set up a conditional formatting rule that compares the date in row 4 with the dates in columns B and C.

To shade days that are weekends, we are using a formula based on the weekday function. By default, the weekday function returns a number between 1 and 7 that corresponds to days of the week, where Sunday is 1 and Saturday is 7. However, by adding the optional second argument called “return type” with a value of 2, the numbering scheme changes so that Monday is 1 and Saturday and Sunday are 6 and 7, respectively.

As a result, to return TRUE for dates that are either Saturday or Sunday, we only need to test for numbers greater than 5.  The conditional formatting formula applied to the calendar area (starting with D4) looks like this:

=WEEKDAY(D$4,2)>5

The reference to D4 is mixed, with the row locked so that the formula continues to evaluate the dates in the header for all rows in the calendar grid.

Post navigation

Previous Post:

COSH function: Description, Usage, Syntax, Examples and Explanation

Next Post:

Excel Data validation require unique number

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • Extract multiple matches into separate rows in Excel
  • IFNA function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel AND Function
  • How to use Excel TRUE Function
  • OR function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • Convert date to month and year in Excel
  • Check If Two Dates are same month in Excel
  • How to get Weekdays, Working days between Two Dates in Excel
  • Get project end date in Excel
  • Calculate total hours that fall between two times in Excel

Grouping

  • Group numbers with VLOOKUP in Excel
  • Group numbers at uneven intervals in Excel
  • If cell contains one of many things in Excel
  • Calculate conditional mode with criteria in Excel
  • Map text to numbers in Excel

General

  • Spell Check in Excel
  • Basic text sort formula in Excel
  • 3D SUMIF for multiple worksheets in Excel
  • AutoFit Column Width, AutoFit Row Height in Excel
  • Find, Select, Replace and Go To Special in Excel
© 2026 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning