The `WEEKDAY` function in Excel is used to determine the day of the week for a given date. It returns a number that corresponds to the day of the week. Here’s how you use it:
Syntax
=WEEKDAY(serial_number, [return_type])
Example Usage
- Basic Usage (Default Return Type):
- Formula: `=WEEKDAY(“2023-10-28”)`
- Result: `7` (if `return_type` is omitted or set to `1`, as October 28, 2023, is a Saturday).
- Custom Return Type:
- Formula: `=WEEKDAY(“2023-10-28”, 2)`
- Result: `6` (if `return_type` is `2`, since Monday is the start of the week and Saturday is the 6th day).
Steps to use in Excel:
- Select the Cell: Click on the cell where you want the result to be displayed.
- Enter the Formula:
- Type `=` followed by `WEEKDAY(`.
- Enter the `serial_number` as a date in quotes, a reference to a cell containing a date, or use a date function.
- If necessary, add the `return_type` after a comma.
- Close the parenthesis and press `Enter`.
- Adjust as Needed:
- You can reference cells instead of typing the date directly: For example, `=WEEKDAY(A1)`, where cell `A1` contains a valid date.
Common Scenarios
=CHOOSE(WEEKDAY(A1), "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
=IF(WEEKDAY(A1, 2) >= 6, "Weekend", "Weekday")
The `WEEKDAY` function is quite flexible and useful for date-related calculations, scheduling, and creating dynamic reports.