MS-Excel / Functions and Formula

Get the Weekday as a Number

Before getting to the name of the day, we'll need to begin by extracting the number of the weekday. Here's the syntax for the WEEKDAY function:

WEEKDAY(serial_number,return_type)

Let's say you want to return the weekday number of 31-Jul-2007. The serial_num is any valid date (in this case 31-Jul-2007) and the return_type is a number that refers to the type of return value. The result you are looking for will determine the return_type that you will use; refer to Table shown below.

WEEKDAY function's return type and result
return_typeDay of Week
1 or omittedNumbers 1 (Sunday) through to 7 (Saturday)
2Numbers 1 (Monday) through 7 (Sunday)
3Numbers 0 (Monday) through 6 (Sunday)

We will use the default function by omitting the return_type. Click in cell A1 and type in a valid Excel date, such as 31-Jul-2007 (which is a Tuesday). Then, click in cell B1 and enter the following formula:

=WEEKDAY(A1)

This formula will return the number 3, which equates to Tuesday, which is the day of the week that 31 July 2007 is. An alternative would be to hardcode the date like this:

=WEEKDAY("31 Jul 2007")
[Contents] [Next]