## Excel Office

Excel How Tos, Tutorials, Tips & Tricks, Shortcuts

# Tag: WEEKDAY function

## WEEKDAY function: Description, Usage, Syntax, Examples and Explanation

What is WEEKDAY function in Excel? WEEKDAY function is one of Date and Time functions in Microsoft Excel that returns the day of the week corresponding to a date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday), by default. Syntax of WEEKDAY function WEEKDAY(serial_number,[return_type]) The WEEKDAY function syntax has the following arguments: Serial_number:  A sequential number that…

## How to calculate next day of week in Excel

To return the next specific day of week (i.e. the next Wednesday, or Friday, or Monday) with a given start date, you can use a formula based on the WEEKDAY function. Formula =date+7-WEEKDAY(date+7-dow) Explanation  In the example shown, the formula in D6 is: =B6+7-WEEKDAY(B6+7-2) Where B6 contains the date Friday, January 16, 2015, and 2 represents Monday, the “dow”. The result is Monday, January…

## How to calculate nth day of week in month in Excel

To get the nth day if week in a month (i.e. the first Tuesday, third Tuesday, forth Thursday, etc.) you can use a formula based on the DAY and WEEKDAY functions. Formula =date-DAY(date)+1+n*7-WEEKDAY(date-DAY(date)+8-dow) Note:  Day of week is abbreviated “dow” in the generic form of the formula. This is a number between 1 (Sunday) and 7 (Saturday) which can be changed…

## Get work hours between dates custom schedule in Excel

To calculate work hours between two dates with a custom schedule, you can use a formula based on the WEEKDAY and SUMPRODUCT functions, with help from ROW, INDIRECT, and MID. Formula =SUMPRODUCT(MID(schedule,WEEKDAY (ROW(INDIRECT(start&”:”&end))),1)*ISNA (MATCH(ROW(INDIRECT(start&”:”&end)),holidays,0))) Explanation In the example shown, the formula in F8 is: =SUMPRODUCT(MID(D6,WEEKDAY(ROW (INDIRECT(B6&”:”&C6))),1)*ISNA(MATCH (ROW(INDIRECT(B6&”:”&C6)),holidays,0))) Which returns 36 hours, based on a custom schedule where 8 hours are…

## Roll back weekday to Friday base on a particular date in Excel

Case study: If Monday, roll back to Friday To check the weekday of a date, and roll back to Friday when the date is a Monday, you can use the IF and WEEKDAY functions. Formula =IF(WEEKDAY(date)=2,date-3,date) Explanation In the example shown, the formula in C5 is =IF(WEEKDAY(B5)=2,B5-3,B5) How this formula works The WEEKDAY function returns a number, 1-7, that corresponds…

## Generate series of dates by weekends in Excel

This tutorials covers how to generates Series of dates increment by weekends from a single start date in Excel. If need to generate a dynamic series of dates with a formula that include only future weekend dates (i.e. Sat and Sun), you can do so with a formula that uses the IF and WEEKDAY functions. Formula =IF(WEEKDAY(date)=7,date+1,date+(7-WEEKDAY(date))) Explanation   In the…

## Calculate series of dates by workdays in Excel

This tutorials covers how to generate series of dates increment by workdays from a single start date in Excel If need to generate a dynamic series of dates that are workdays only (i.e. Monday through Friday), you can do so with a simple formula that uses the the WORKDAY function Formula =WORKDAY(date,1) Explanation   In the example, B6 is the hard-coded…

## Custom weekday abbreviation in Excel

This tutorial shows how to create custom weekday abbreviation in Excel using example below. To create a custom weekday abbreviation, you can use a formula based on the CHOOSE and WEEKDAY functions. With this approach, you can generate a custom one-letter abbreviation, two-letter abbreviation, or any weekday that makes sense in your particular situation. Formula =CHOOSE(WEEKDAY(date),”S”,”M”,”T”,”W”,”T”,”F”,”S”) Explanation In the example shown,…

## Count day of week between dates in Excel

This tutorial shows how to Count day of week between dates in Excel using example below. To count the number of Mondays, Fridays, Sundays, etc. between two dates you can use an array formula that uses several functions: SUMPRODUCT, WEEKDAY, ROW, and INDIRECT.  Formula =SUMPRODUCT(–(WEEKDAY(ROW(INDIRECT(date1&”:”&date2)))=dow)) Explanation In the example shown, the formula in cell E6 is =SUMPRODUCT(–(WEEKDAY(ROW(INDIRECT(B6&”:”&C6)))=D6)) How this formula…

## Steps to create Dynamic calendar grid in Excel

This tutorial show how to  create Dynamic calendar grid in Excel using the example below. You can set up dynamic calendar grid on an Excel worksheet with a series of formulas, as explained in this article. Explanation of how this formula works In the example shown, the formula in B6 is: =start-CHOOSE(WEEKDAY(start),0,1,2,3,4,5,6) where “start” is the named range K5, and contains the date…

## Get last weekday in month in Excel

This tutorial shows you how to find the last weekday of the month in Excel. To get the last weekday in a month (i.e. the last Saturday, the last Friday, the last Monday, etc) you can use a formula based on the EOMONTH and WEEKDAY functions. Formula =EOMONTH(date,0)+1-WEEKDAY(EOMONTH(date,0)+1-dow) Explanation First, this formula determines the first day of the next month…

## Excel Data validation allow weekday only

Using the example below, this tutorial shows how to use Excel Data validation allow weekday only. Formula =WEEKDAY(A1,2)<6 Explanation Note: Excel has several built-in data validation rules for dates. This page explains how to create a your own validation rule based on a custom formula if you need more control or flexibility. To allow a user to enter only dates that are…

## Highlight dates that are weekends in Excel

This tutorial shows how to Highlight dates that are weekends in Excel  using the example below; Formula =OR(WEEKDAY(A1)=7,WEEKDAY(A1)=1) Explanation If you want to use conditional formatting to highlight dates occur on weekends (i.e. Saturday or Sunday),  you can use a simple formula based on the WEEKDAY function. For example, if you have dates in the range C4:C10, and want to…

## Conditional formatting gantt chart weekends in Excel

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…

## Count dates by day of week in Excel

This tutorial shows how to Count dates by day of week in Excel using the example below; Formula =SUMPRODUCT(–(WEEKDAY(dates)=day_num)) Explanation To count dates by weekday (i.e. count Mondays, Tuesdays, Wednesdays, etc.), you can use the SUMPRODUCT function together with the WEEKDAY function. In the example shown, the formula in F4 is: =SUMPRODUCT(–(WEEKDAY(dates,2)=G4)) Note: “dates” is the named range B4:B15. How this formula works…

## Sum by weekday in Excel

This tutorial shows how to Sum by weekday in Excel using the example below; Formula =SUMPRODUCT((WEEKDAY(dates)=day_num)*values) Explanation To sum data by weekday (i.e. sum by Mondays, Tuesdays, Wednesdays, etc.), you can use the SUMPRODUCT function together with the WEEKDAY function. In the example shown, the formula in H4 is: =SUMPRODUCT((WEEKDAY(dates,2)=G4)*amts) How this formula works You might wonder why we aren’t using…

## OR function Examples in Excel

The OR function in Excel returns TRUE if any of the conditions are TRUE and returns FALSE if all conditions are false. Combine the OR function with other functions and become an Excel expert. 1. For example, take a look at the OR function in cell D2 below. Explanation: the OR function returns TRUE if the first score is greater than 70 or the…

## How to get Weekdays, Working days between Two Dates in Excel

Learn how to get the day of the week of a date in Excel and how to get the number of weekdays/working days between two dates. Weekday Function 1. The WEEKDAY function in Excel returns a number from 1 (Sunday) to 7 (Saturday) representing the day of the week of a date. Apparently, 12/18/2017 falls on a Monday. 2. You can also use the TEXT function…

## How to get Holiday Date from Year in Excel

This example teaches you how to get the date of a holiday for any year (2019, 2020, etc). Before you start: the CHOOSE function returns a value from a list of values, based on a position number. For example, =CHOOSE(3,”Car”,”Train”,”Boat”,”Plane”) returns Boat. The WEEKDAY function returns a number from 1 (Sunday) to 7 (Saturday) representing the day of the week of a date. 1. This is…