Learn how to use the Excel WEEKDAY function with syntax and examples.
The Microsoft Excel WEEKDAY function returns a number representing the day of the week, given a date value.
The syntax for the Microsoft Excel WEEKDAY function is:
WEEKDAY( serial_number, [return_value] )
serial_number is a date expressed as a serial number or a date in quotation marks.
return_value is optional. It is the option used to display the result. It can be any of the following values:
|1||Returns a number from 1 (Sunday) to 7 (Saturday). This is the default if parameter is omitted.|
|2||Returns a number from 1 (Monday) to 7 (Sunday).|
|3||Returns a number from 0 (Monday) to 6 (Sunday).|
If this parameter is omitted, the WEEKDAY function assumes that the return_value is set to 1.
The WEEKDAY function can be used in the following versions of Microsoft Excel:
The WEEKDAY function can be used in Microsoft Excel as the following type of function:
Let's look at some Excel WEEKDAY function examples and explore how to use the WEEKDAY function as a worksheet function in Microsoft Excel:
Based on the spreadsheet above, the following Excel WEEKDAY examples would return:
=WEEKDAY(A1) Result: 1 =WEEKDAY(A1, 1) Result: 1 =WEEKDAY(A1, 2) Result: 7 =WEEKDAY(A1, 3) Result: 6 =WEEKDAY(A2) Result: 5 =WEEKDAY(A3) Result: 6 =WEEKDAY(38157) Result: 7 =WEEKDAY("July 12, 2004") Result: 2
The WEEKDAY function can also be used in VBA code in Microsoft Excel.
Let's look at some Excel WEEKDAY function examples and explore how to use the WEEKDAY function in Excel VBA code:
Dim LWeekday As Integer LWeekday = Weekday("12/31/2001", vbSunday)
In this example, the variable called LWeekday would now contain the value of 2.
Question: Is there a LIKE function in Excel similar to the one in Access? I'm trying to write a formula equivalent to the following:
=if(D14 like "*Saturday*", Now()+2, Now()+1)
Where cell D14 is a date value formatted as Saturday, August 27, 2005.
Answer: Since your value in cell D14 is a date value, you can use the WEEKDAY function to determine which day of the week it is. In this case, you are looking for a Saturday. The WEEKDAY function will return a value of 7 when the date falls on a Saturday.
Try using the following formula:
(scroll to see more)