WEEKDAY ()
This
function shows the day of the week from a date.
Best view in desktop mode.
A
|
B
|
C
|
D
|
|
1
|
Date
|
Weekday
|
||
2
|
Fri 21-Feb-20
|
6
|
=WEEKDAY(C4)
|
|
3
|
Wed 19-Feb-20
|
4
|
=WEEKDAY(C5)
|
|
4
|
Sat 15-Aug-20
|
7
|
=WEEKDAY(C6,1)
|
|
5
|
Sat 15-Aug-20
|
6
|
=WEEKDAY(C7,2)
|
|
6
|
Sat 15-Aug-20
|
5
|
=WEEKDAY(C8,3)
|
|
7
|
Syntax
=WEEKDAY(Date,
Type)
=WEEKDAY(serial_number,
[return_type])
Type: This is used to indicate the week
day numbering system.
1:
will set Sunday as 1 through to Saturday as 7
2:
will set Monday as 1 through to Sunday as 7.
3:
will set Monday as 0 through to Sunday as 6.
If no number is specified, Excel will use 1.
Formatting
The result will
be shown as a normal number. To show the result as the name of the day, use
Format, Cells, and Custom and set the Type to ddd or dddd.
Shortcut Key for Formatting
Press Ctrl+1, and
you will see new pop-up window like below:
Example
The following
table was used by a hotel which rented a function room.
The hotel charged
different rates depending upon which day of the week the booking was for.
A
|
B
|
C
|
D
|
E
|
|
1
|
Enter Booking Date
|
7-Feb-20
|
|||
2
|
Actual Day
|
Friday
|
=WEEKDAY(B1)
|
||
3
|
Booking Cost
|
$ 50.00
|
=LOOKUP(WEEKDAY(B1),A8:B14)
|
||
4
|
|||||
5
|
|||||
6
|
Booking Rates
|
||||
7
|
Day Of Week
|
Cost
|
|||
8
|
1
|
$
50.00
|
|||
9
|
2
|
$
25.00
|
|||
10
|
3
|
$
25.00
|
|||
11
|
4
|
$
30.00
|
|||
12
|
5
|
$
40.00
|
|||
13
|
6
|
$
50.00
|
|||
14
|
7
|
$
100.00
|
|||
15
|
The Booking
Date is entered in cell B1.
The Actual
Day is calculated in cell B2.
The Booking
Cost is picked from a list [A8:B14] of
rates using the LOOKUP()
function.
And in cell B3, booking cost show as result.
And in cell B3, booking cost show as result.
No comments:
Post a Comment