w3resource

Excel WEEKDAY() function

WEEKDAY() function

This function is used to return 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.

Version: Excel 2013

Syntax:

WEEKDAY(serial_number,[return_type])

Parameters

Name Description Data Type Required/
Optional
Serial_number A sequential number that represents the date of the day you are trying to find. Dates should be entered by using the DATE function, or as results of other formulas or functions. Number Required
Return_type A number that determines the type of return value. Number Optional


Here is a table below shows the return type and number values which indicate starting and ending weekday number and the days.

Return_type Number returned
1 or omitted Numbers 1 (Sunday) through 7 (Saturday). Behaves like previous versions of Microsoft Excel.
2 Numbers 1 (Monday) through 7 (Sunday).
3 Numbers 0 (Monday) through 6 (Sunday).
11 Numbers 1 (Monday) through 7 (Sunday).
12 Numbers 1 (Tuesday) through 7 (Monday).
13 Numbers 1 (Wednesday) through 7 (Tuesday).
14 Numbers 1 (Thursday) through 7 (Wednesday).
15 Numbers 1 (Friday) through 7 (Thursday).
16 Numbers 1 (Saturday) through 7 (Friday).
17 Numbers 1 (Sunday) through 7 (Saturday).

Remarks:

  • Microsoft Excel stores date as sequential serial numbers so they can be used in calculations. By default, January 1, 1900, is serial number 1, and January 1, 2010, is serial number 40179 because it is 40178 days after January 1, 1900.
  • when serial_number is out of range for the current date base value, a #NUM! error is returned.
  • when return_type is out of the range specified in the table above, a #NUM! error is returned.

Example - 1:

The example below returns the day of the week, with numbers 1 (Sunday) through 7 (Saturday). In this example the specified date is Friday and this week starts with 4/15/2012, Sunday. Here no return type mention, so default return type is 1, Sunday to Saturday (1 to 7) so the return value is 6.

weekday1

Example - 2

The example below returns the day of the week, with numbers 1 (Monday) through 7 (Sunday). In this example the specified date is Friday. Here the return type mention is 2, Monday through Sunday (1 to 7), i.e. first day of the week is 4/16/2012, Monday, so the specified date is the 5th day of the week.

weekday2

Example - 3

The example below returns the day of the week, with numbers 0 (Monday) through 6 (Sunday). In this example the specified date is Friday. Here the return type mention is 3, Monday through Sunday (0 to 6), i.e. first day of the week is 4/16/2012, Monday, so the specified date is the 4th day of the week.

weekday3

Previous: Excel TODAY() function
Next: Excel WEEKNUM() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/excel/excel-weekday-function.php