Date and Time Functions: Cambridge AS Level Satree Phuket School - IPC
Date and Time Functions: Cambridge AS Level Satree Phuket School - IPC
Cambridge AS level
Satree Phuket School - IPC
Today’s date
1. To enter today's date in Excel, use the TODAY function.
2
Today’s date
2. To enter the current date and time, use the NOW function.
3
Today’s date
3. To enter the current time only, use NOW()-TODAY() and
apply a time format.
4
Static Date & Time
1. To enter the current date as a static value, press CTRL + ;
(semicolon).
5
Static Date & Time
2. To enter the current time as a static value, press CTRL +
SHIFT + ; (semicolon).
6
Static Date & Time
3. To enter the current date and time as a static value, simply
press CTRL + ; (semicolon), enter a space and press CTRL +
SHIFT + ; (semicolon).
7
Date Difference
1. Fill in "d" for the third argument to get the number of days
between two dates.
Note: =A2-A1 produces the exact same result!
8
Date Difference
2. Fill in "m" for the third argument to get the number of months between two
dates.
9
Date Difference
3. Fill in "y" for the third argument to get the number of years between two dates.
10
Date Difference
4. Fill in "yd" for the third argument to ignore years and get the number of days
between two dates.
11
Date Difference
5. Fill in "md" for the third argument to ignore months and get the number of days
between two dates.
12
Date Difference
6. Fill in "ym" for the third argument to ignore years and get the number of
months between two dates.
13
Date Difference
Important note: the DATEDIF function returns the number of complete days, months or years. This may
give unexpected results when the day/month number of the second date is lower than the day/month
number of the first date. See the example below.
14
Time Difference
1. Simply subtract the start time from the end time.
15
Time Difference
2. Change the number format of the values in cell A2, B2
and C2 to General.
16
Time Difference Formula
The simple formula shown above doesn't work if the start
time is before midnight and the end time is after midnight.
1. Times that are negative show as ######.
17
Time Difference Formula
2. To clearly see this, change the number format of the
values in cell A2, B2 and C2 to General.
18
Time Difference Formula
3. The time difference formula below always works.
Explanation: if the end time is greater than or equal to the start time, simply
subtract the start time from the end time. If not, add 1 (full day) to the end time
to represent a time on the next day and subtract the start time.
19
Time Difference in Hours as Decimal Value
20
Calculate Age
To calculate the age of a person in Excel, use the DATEDIF function and the
21
Calculate Age
2. Enter the TODAY function into cell B2 to return today's
date.
22
Calculate Age
3. The DATEDIF function below calculates the age of a person.
Note: fill in "y" for the third argument to get the number of complete years
between the date of birth and today's date.
23
Calculate Age
4. Calculate the age of a person without displaying today's date.
24
Calculate Age
5. Calculate the age of a person on a specific date.
Note: the DATE function accepts three arguments: year, month and day.
25
Calculate Age
6. Calculate the age of a person in years, months and days.
Note: fill in "ym" for the third argument to ignore years and get the number of
months between two dates. Fill in "md" for the third argument to ignore
months and get the number of days between two dates. Use the & operator to
concatenate strings.
26
WeekDay Function
1. The WEEKDAY function in Excel returns a number from 1 (Sunday) to 7
(Saturday) representing the day of the week of a date. Apparently, 12/18/2017
falls on a Monday.
27
Week Days
2. You can also use the TEXT function to display the day of the week.
28
Week Days
3. Or create a custom date format (dddd) to display the day of the week.
29
Networkdays function
1. The NETWORKDAYS function returns the number of weekdays (weekends
excluded) between two dates.
30
Networkdays function
2. If you supply a list of holidays, the NETWORKDAYS function returns the
number of workdays (weekends and holidays excluded) between two dates.
32
Days Until Birthday
33
Days Until Birthday
34
Days Until Birthday
3. The most difficult part in order to get the number of days until your birthday
is to find your next birthday. The formula below does the trick.
35
Days Until Birthday
4. Next, we use the DATEDIF function to find the number of days ("d") between
36
Time Sheet
1. To automatically calculate the next 4 days and dates when you enter a start
date, use the formulas below.
37
Time Sheet
2. Select the cells containing the times.
38
Time Sheet
3. Right click, click Format Cells, and select the right Time format. Use the
circled format for cell K12, K13 and K14.
39
Time Sheet
4. To automatically calculate the hours worked each day, the total hours and the overtime hours, use
the formulas below.
40