How to Use WEEKDAY Function in Excel ( With 8 Examples)

The WEEKDAY function is especially handy for planning, scheduling, and even financial analysis. It is classified as a Date and Time function in Excel which returns the day of the week for a given argument.

In this article, I’ll discuss the ins and outs of the WEEKDAY function including real-life examples with proper explanations. So that you may adjust the formula for your purpose.

WEEKDAY Function in Excel (Quick View)

WEEKDAY Function in Excel (Quick View)

Download Excel Workbook

Excel WEEKDAY Function: Syntax & Arguments

Firstly, we’ll see the syntax and argument of the function. If you insert the function after entering equal sign (=), you’ll see the following figure.

WEEKDAY Formula

Summary

Returns the day (in numbers) of the week with respect to a given date. In the default configuration, the day is represented as an integer with values ranging from 1 (Sunday) to 7 (Saturday).

Syntax

=WEEKDAY(serial_number, [return_type])

Return Values

0 to 7 (in numbers)

Arguments

Argument Required or Optional Value
serial_number  Required A number representing the day from which you want to find the day of the week
return_type Optional A number determining the return value type

Note:

  1. Dates are stored in Microsoft Excel as consecutive serial numbers, which allows them to be used in calculations. Besides, dates should be inserted as the date format or using the DATE function. There may be problems if the dates are inserted in text format.
  2. Return_type is an argument in the WEEKDAY function which specifies the first day of the week. If you omit to input any return_type, the WEEKDAY function returns 1 for Sunday and 7 for Saturday (by default). Return type 11-17 is introduced in Excel 2010 version.
return_type First day Numerical result Start-end
1 or omitted (default) Sunday 1-7 Sunday-Saturday
2 Monday 1-7 Monday-Sunday
3 Tuesday 0-6 (since Monday = 0 in this case) Monday-Sunday
11 Monday 1-7 Monday-Sunday
12 Tuesday 1-7 Tuesday-Monday
14 Thursday 1-7 Thursday-Wednesday
15 Friday 1-7 Friday-Thursday
16 Saturday 1-7 Saturday-Friday
17 Sunday 1-7 Sunday-Saturday

How to Use the WEEKDAYFunction in Excel (8 Examples)

Example 1: Basic Examples of WEEKDAY Function

If the days are given as date format and do not need to input the return_type value, you may utilize the following formula.

=WEEKDAY(C5)

Basic Examples of WEEKDAY Function

But if the return type is 2 and 16 respectively for the same dataset. You may use the following formula.

When the value of return_type is 2:

=WEEKDAY(C5,2)

When the value of return_type is 16:

=WEEKDAY(C5,16)

Basic Examples of WEEKDAY Function

Example 2: Using WEEKDAY Function with DATE Function

Let’s imagine that the joining date is given in serial number. In that case, you have to use the DATE where the YEAR, MONTH, and DAY functions are used to return the year, month, and day of the given date respectively.

Just use the following formula.

=WEEKDAY(DATE(YEAR(C5),MONTH(C5),DAY(C5)),12)

Using WEEKDAY Function with DATE Function

Example 3: Using TEXT Function to Find the Weekday Name

If you want to get the name of the day of the week that is found using the WEEKDAY function, you may use the TEXT formula.

=TEXT(WEEKDAY(C5,2),"dddd")

Here, “dddd” is a format to return the name of a day.

Using TEXT Function to Find the Weekday Name

Example 4: WEEKDAY Combined with the CHOOSE Function

Besides, there is another way to find the name of the weekday. You can use the CHOOSE function with the WEEKDAY function. Just use the following formula.

=CHOOSE(WEEKDAY(C5),"Sun","Mon","Tue","Wed","Thu","Fri","Sat")

Combined with the CHOOSE Function

Example 5: Combined with the SWITCH Function

Again, you may use the SWITCH function to get the name of the weekday with the WEEKDAY function. The formula will be-

=SWITCH(WEEKDAY(C5,1),1,"Sun",2,"Mon",3,"Tue",4,"Wed",5,"Thu",6,"Fri",7,"Sat")

Combined with the SWITCH Function

Example 6: WEEKDAY Function to Get Weekdays and Weekends

If you want to determine the weekdays and weekends for a given date, you may utilize the formula.

=IF(WEEKDAY(C5,2)<6,"Workday","Weekend")

Here, return_type 2 means the weekday is from Monday to Sunday. The IF(WEEKDAY(C5,2)<6 syntax returns the date whether it is workday or weekend. If the result is true, the result will be shown as “Workday”, otherwise “Weekend” will be shown.

WEEKDAY Function to Get Weekdays and Weekends

Example 7: WEEKDAY Function with Conditional Formatting

If you guys need to highlight the workday and weekend for better visualization, you may use the Conditional Formatting toolbar from the Styles command bar.

Now select the data and open a New Formatting Rule dialog box by clicking the Home tab>Conditional Formatting>New Rules.

Then choose the option Use a formula to determine which cells to format, and insert the following formula for the workday. Lastly, open the format option to specify the highlighting color.

=WEEKDAY($C5,2)<6

Conditional Formatting

Similarly, insert the following formula for highlighting the weekend.

=WEEKDAY($C5,2)>5

Conditional Formatting

Now, you’ll get the following output.

WEEKDAY Function with Conditional Formatting

Example 8: Calculating Payment Including Weekends

At last, we’ll see an interesting example. Assuming you have a project to finish within a deadline, and you have to manage your employee to do extra work on working days and weekends.

Usually, the rate of payment is higher for weekends. If the number of working hours is given, you need to calculate the payment for each employee and the total payment for all employees.

The formula will be-

=IF(WEEKDAY(C5, 2)>5, D5*$H$6,D5*$H$7)

Then use the SUM function for aggregating the individual payment.

Calculating Payment Including Weekends

Common Errors While Using the WEEKDAY Function

Common Errors When they show
#NUM – if the serial number is out of range for the current date’s base value

– if the return_type is out of range from the return_type value table as shown in the arguments section.

#VALUE! error – occurs when either the given serial_number or the given [return_type] is non-numeric.

Conclusion

This is how you can apply the WEEKDAY function to get the day of the week (weekday). Also, you have the opportunity to combine the function with other Excel functions. If you have an interesting and unique method of using the WEEKDAY function, please share it in the comments section below.

Thanks for being with me.


Further Readings:

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo