Excel WEEKDAY function
Excel has many inbuilt functions to work with weekdays and days in a year. The Excel WEEKDAY function is one among them and this function is generally used to extract the weekday as a numeric value. This Excel function is particularly useful for scheduling. Now let us see the syntax of Excel WEEKDAY function and know how is it used.
= WEEKDAY (serial_num,[return_type])
Parameters (or) Arguments
serial_num (required)- It always represents the date for which you want to get the day of the week.
return_type (optional)- It should be a number representing the weekday based on the mapping scheme (the mapping scheme used is explained in the further section). By default, the value is 1.
How does the Excel WEEKDAY function work?
- This Excel function accepts a date and returns a value between 1 to 7 representing a day of the week for the given date. The default 1 represents a Sunday and a 7 represents a Saturday. The value (or) a number representing weekday is as shown below.
- The WEEKDAY function contains the argument called the return_type which makes the use of a mapping scheme to map each weekday to a numeric value and table below, shows the mapping along with the result associated with each of the return type value.
The WEEKDAY function in Excel will return a numeric value even if the date parameter is empty.
Note on WEEKDAY function examples
The Excel WEEKDAY function can also be used to perform different operations when combined with other functions in Excel. Some of the examples are as given below
- Highlighting the dates that are weekends and also generating a series of dates by workdays
- We can create a custom weekdays by using formulae based on the Excel CHOOSE and WEEKDAY built-in functions.
- To check the weekday of a date and to roll back to a Friday when the date is a Monday by using weekday function along with an IF function.
- It is also used to create Gantt chart weekends to add the data by its weekdays also used to set up a calendar grid (dynamic), used to get the ‘nth’ weekday in a month, last weekday in a month, the next weekday, to get work hours between dates etc.
To better understand its usage let us take a look at an example which consists of different dates and types and result returned by the function as shown below.
Figure 1. The WEEKDAY function used to obtain the above result