Abdul Alim: a little bit learning, let's go
Excel, VBA and Power BI tutorials
Abdul Alim: a little bit learning, let's go
Excel, VBA and Power BI tutorials
The WEEKDAY formula in Excel is a handy tool that returns the day of the week corresponding to a date, with the result as an integer ranging from 1 (Sunday) to 7 (Saturday).
WEEKDAY assists in extracting the day of the week from a given date. This is incredibly useful in scenarios where you need to perform data analysis based on the days of the week.
The syntax for creating formulas in Excel, particularly WEEKDAY, is:
=WEEKDAY(serial_number, [return_type])
The WEEKDAY formula uses two parameters:
serial_number: This mandatory parameter represents the date for which you want to find the day of the week.
return_type: An optional parameter which dictates the day numbering system to use. If omitted, Excel defaults to 1 (Sunday) to 7 (Saturday).
The WEEKDAY formula returns an integer between 1 and 7 representing the day of the week.
WEEKDAY only considers the date component if you input a datetime value. For optimal use, ensure your data is in a format Excel can interpret as a date or datetime.
The WEEKDAY formula is available across all versions of Excel, making it a common addition to most spreadsheet calculators.
Let’s assume cell A1 contains the date “2023-06-23”. To find out the day of the week, you can use:
=WEEKDAY(A1)
Since June 23, 2023, is a Friday, the formula will return 6.
If you have the date “2023-06-24” in cell A1 and want the week to start on Monday (1), use the return_type parameter:
=WEEKDAY(A1, 2)
This will return 6, as June 24, 2023, is a Saturday.
For dates with time values like “2023-06-23 18:00:00” in cell A1, WEEKDAY disregards the time component:
=WEEKDAY(A1)
The formula will return 6, corresponding to Friday.
WEEKDAY can also handle dates in text format. With “2023-06-23” in cell A1:
=WEEKDAY(A1)
The result will again be 6, as June 23, 2023, is a Friday.
For invalid dates like “Hello” in cell A1:
=WEEKDAY(A1)
Excel will return a #VALUE! error, indicating that the input is not a valid date.
Remember that WEEKDAY only extracts the day from a date. It does not return the actual date.
WEEKDAY can’t process text that isn’t a valid date and will return a #VALUE! error.
The #VALUE! error occurs if the serial_number parameter is not a valid date. Make sure your date inputs are valid.
Cross-check the date data to ensure it is valid. Also, use the return_type parameter to control the starting day of the week according to your requirements.
Related Excel functions include:
DATE: Returns the serial number of a particular date.
DAY: Extracts the day of the month from a date.
TODAY: Returns the current date.
WEEKDAY is frequently used with DATE and TODAY formulas for advanced date-based data analysis.
The WEEKDAY formula only considers the date part of a datetime input. The time part is disregarded.
The formula will return a #VALUE! error if the text string can’t be interpreted as a valid date.
You can use the return_type parameter to specify the starting day of the week.
Harness the power of the WEEKDAY formula to refine your data analysis in Excel.