Excel Basics 04
Excel Basics 04
How Dates work in Excel (Date Serial Numbers, Date Number Format and Date Formulas) …...................................... 2
Formulas to calculate number of days between two dates, for invoices, loans and projects …...................................... 4
Formulas to count workdays with NETWORKDAYS.INTL function …........................................................................... 5
Add days to date to get future date. Learn about WORKDAY.INTL function. Examples: calculating loan due dates …...... 6
Subtract days from dates to get past date. Examples such as calculating the date that a project was started …............ 6
Move date by a specified number of months with EDATE and EOMONTH functions. Examples with invoices …............... 7
Extract the year, month or day from date using the functions, YEAR, MONTH, DAY, and TEXT. Examples for a date ta 8
How Times work in Excel (Time Serial Numbers, Time Number Format and Time Formulas) …...................................... 9
Time Formulas for Payroll …................................................................................................................................. 11
Time Formulas for Night Shift Payroll. Learn about Date-Time Values and the MOD function …..................................... 12
List of All 26 Date & Time Formulas and Functions ….............................................................................................. 13
1 of 56
MS 365 Excel Basics #4
Date Time Number Formatting, Formulas, Functions Calculations
A B C D E F G H I
1
2 Invoice Due Date 10/25/2024 In USA enter dates like: Month/Day/Year or Month-Day-Year
3 Today 11/20/2024 Keyboard for today's date: Ctrl + ;
4 Days Past Due Important Formula: Days between dates = Later Date - Earlier Date
5
6 How does that work?
7
8 Dates in Excel:
9 When you type a date, an automatic Date Number Format is applied on top of a Date Serial Number,
10 which is the number of days since Dec, 31, 1899. 1/1/1900 = 1, 1/2/1900 = 2
11
12 Today General Number Format Keyboard = Ctrl + Shift + ~ / `
13
14 Examples of Dates:
15
16 Date Serial Number
17 12/31/1899 1 First day that Excel understands
18 1/1/1900 2 Second day that Excel understands
19 11/17/2024 45613 The date 11/17/2024 is 45613 days since Dec 31, 1899
20 5/5/9999 2958225 The date 5/5/9999 is 2958225 days since Dec 31, 1899
21 12/31/1899 Text Text because it is before the first day that Excel recognizes as a date value.
22 7/4/1776 Text Text because it is before the first day that Excel recognizes as a date value.
Column not
23
################### wide enough #### tells you that the column not wide enough to display Date with Numb
24
25 There are Many Number Formats for Dates:
26 Today Serial Number
27 11/17/2024 45613
28 11/17/2024 45613
29 11/17/2024 45613
30 11/17/2024 45613
31 11/17/2024 45613 Number Formatting Code: m = month, d = day, y = year
32 Such as: ddd, m/d/yyy to show Sun, 11/17/2024
33
890945365.xlsx - DateSerialNums 2 of 56
MS 365 Excel Basics #4
Date Time Number Formatting, Formulas, Functions Calculations
J K L
1
Month-Day-Year
2
3
ater Date
4 - Earlier Date
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
l recognizes
21 as a date value.
l recognizes
22 as a date value.
23
gh to display Date with Number Formatting
24
25
26
27
28
29
30
y, y = 31
year
32
33
890945365.xlsx - DateSerialNums 3 of 56
A B C D E F G H I
1
2 Invoice Due Date 10/25/2024 In USA enter dates like: Month/Day/Year or Month-Day-Year
3 Today 11/20/2024 Keyboard for today's date: Ctrl + ;
4 Days Past Due 26 Important Formula: Days between dates = Later Date - Earlier Date
5
6 How does that work? C4: =C3-C2
7
8 Dates in Excel:
9 When you type a date, an automatic Date Number Format is applied on top of a Date Serial Number,
10 which is the number of days since Dec, 31, 1899. 1/1/1900 = 1, 1/2/1900 = 2
11
12 Today 45616 General Number Format Keyboard = Ctrl + Shift + ~ / `
13
14 Examples of Dates:
15
16 Date Serial Number
17 12/31/1899 1 First day that Excel understands
18 1/1/1900 2 Second day that Excel understands
19 11/17/2024
45613 The date 11/17/2024 is 45613 days since Dec 31, 1899
20 5/5/9999
2958225 The date 5/5/9999 is 2958225 days since Dec 31, 1899
21 12/31/1899 Text Text because it is before the first day that Excel recognizes as a date value.
22 7/4/1776 Text Text because it is before the first day that Excel recognizes as a date value.
Column not
23
################### wide enough #### tells you that the column not wide enough to display Date with Numb
24
25 There are Many Number Formats for Dates:
26 Today Serial Number
27 11/17/2024 45613
28 Sunday, November 17, 2024 45613
29 11/17 45613
30 17-Nov-24 45613
31 Sunday, 11/17/2024 45613 Number Formatting Code: m = month, d = day, y = year
32 Such as: ddd, m/d/yyy to show Sun, 11/17/2024
33
Date 11/1/2024
Date Custom
Number Format Date = 11/1/2024 What Number Format Shows
d 1 Day number
dd 01 Day number with lead zero
ddd Fri 3 letter day
dddd Friday Full day name
m 11 Month number
mm 11 Month number with lead zero
mmm Nov 3 letter month
mmmm November Full month name
y 24 Last 2 digits of year
yy 24 Last 2 digits of year
yyy 2024 4 digit year
yyyy 2024 4 digit year
m/d/yyy 11/1/2024 Forward slash ok
m-d-yyy 11-1-2024 Dash ok
ddd, m/d/yy Fri, 11/1/24 Comma ok
890945365.xlsx - DateNF 6 of 56
A B C D E F G H
1
2 Difference Between Two Dates
3
4 Question: Start End Days: Formula:
5 How many days until school starts? 8/15/2024 9/26/2024 1
6 How many days is the invoice past due? 2/28/2024 3/1/2024 2
7 How many days was the loan outstanding? 9/5/2024 1/3/2025 3
8 How many days did the project take?
12/27/2024 3/1/2025 4
9 How many days of vacation, including 1st day? 8/15/2024 9/26/2024 5
I
1
2
3
4 Notes:
5 Difference between dates,
6 not including 1st day
7 = EndDate - StartDate
Difference between dates,
8 including 1st day
= EndDate - StartDate +
9 1
A B C D E F G H
1
2 Difference Between Two Dates
3
4 Question: Start End Days: Formula:
5 How many days until school starts? 8/15/2024 9/26/2024 42 1 E5: =D5-C5
6 How many days is the invoice past due? 2/28/2024 3/1/2024 2 2 E6: =D6-C6
7 How many days was the loan outstanding? 9/5/2024 1/3/2025 120 3 E7: =D7-C7
8 How many days did the project take?
12/27/2024 3/1/2025 65 4 E8: =D8-C8+1
9 How many days of vacation, including 1st day? 8/15/2024 9/26/2024 43 5 E9: =D9-C9+1
5
Mon, 1/15/2024
6
Mon, 1/22/2024
7 Mon, 1/29/2024
8 Fri, 2/16/2024
9
10
11
12
13
14
15
A B C D E F G H
1
2 Count Workdays (difference between dates, while skipping some days)
3
4 Question: Start End Days: Formula:
5
Mon, 1/15/2024
6
Mon, 1/22/2024
7 Mon, 1/29/2024
8 Fri, 2/16/2024
9
10
11
12
13
14
15
4
Notes:
YEAR creates the year as a number from a
5
Serial Number Date
MONTH creates the month as a number
6
from a Serial Number Date
DAY creates the day as a number from a
7
Serial Number Date
8 TEXT converts a number to text based on
9 Number Formatting Code.
A B C D E F G
1
2 Year, Month, Day from Date Serial Number
3
Start
4
Question: Date Date: Formulas:
5 Year
11/17/2024 2024 16 D5: =YEAR(C5)
6 Month
11/17/2024 11 17 D6: =MONTH(C6)
7
Day 11/17/2024 17 18 D7: =DAY(C7)
8 Day Name? 11/17/2024 Sunday 19 D8: =TEXT(C8,"dddd")
9 Month Name? 11/17/2024 Nov 20 D9: =TEXT(C9,"mmm")
4
Notes:
YEAR creates the year as a number from a
5
Serial Number Date
MONTH creates the month as a number
6
from a Serial Number Date
DAY creates the day as a number from a
7
Serial Number Date
8 TEXT converts a number to text based on
9 Number Formatting Code.
12
Type 8 a,
Enter
Type 8 a,
13 Ctrl + Enter,
Ctrl + Shift + ~/` What Excel did behind the scenes when you entered 8:00 AM is: 8 /24 = 1/3 = 0.333…
Type formula =8/24,
14 Ctrl + Enter,
Apply Time Number Format The proportion of 8 hours to 24 hours in day with Time Number Formatting applied
15
16 Q: How to calculate hours between two dates when Excel divides time value by 24?
17 A: Multiply by 24 to get decimal back up to an hour unit, like: (End Time - Start Time)*24
18
19 Time In (Start) 8:00 AM
20 Time Out (End) 5:15 PM
21 Hours Worked (End Time - Start Time)*24
22 Remember: Ctrl + Shift + ~/` to remove Time Number Format
23
24 Time In (Start1) 8:00 AM
25 Time Out (End1) 12:05 PM
26 Time In (Start2) 1:15 PM
27 Time Out (End2) 5:15 PM
28 Hours Worked
29 Do not round times: keep all the decimals.
30 Remember: Ctrl + Shift + ~/` to remove Time Number Format
31
32 Time Change Number Formatting
33 8:00 PM 0.833333333333333 Number Formatting Code: h = hour, m = minute, s = second, separated by colon.
34 8:00 PM 0.833333333333333 Such as: h:mm AM to show 8:00 AM or h:mm to show 20:00 for 8:00 PM
35 8:00 PM 0.833333333333333
36 8:00 PM 0.833333333333333
12
Type 8 a,
Enter 8:00 AM
Type 8 a,
13 Ctrl + Enter,
Ctrl + Shift + ~/` 0.333333333333333 What Excel did behind the scenes when you entered 8:00 AM is: 8 /24 = 1/3 = 0.333…
Type formula =8/24,
14 Ctrl + Enter,
Apply Time Number Format 08:05:00 AM The proportion of 8 hours to 24 hours in day with Time Number Formatting applied
15
16 Q: How to calculate hours between two dates when Excel divides time value by 24?
17 A: Multiply by 24 to get decimal back up to an hour unit, like: (End Time - Start Time)*24
18
19 Time In (Start) 8:00 AM
20 Time Out (End) 5:15 PM
21 Hours Worked 9.25 (End Time - Start Time)*24 =(C20-C19)*24
22 Remember: Ctrl + Shift + ~/` to remove Time Number Format
23
24 Time In (Start1) 8:00 AM
25 Time Out (End1) 12:05 PM
26 Time In (Start2) 1:15 PM
27 Time Out (End2) 5:15 PM
28 Hours Worked 8.08333333333333 (EndTime1 - StartTime1+EndTime2 - StartTime2)*24 =(C25-C24+C27-C26)*24
29 Do not round times: keep all the decimals.
30 Remember: Ctrl + Shift + ~/` to remove Time Number Format
31
32 Time Change Number Formatting
33 8:00 PM 0.833333333333333 Number Formatting Code: h = hour, m = minute, s = second, separated by colon.
34 08:00 PM 0.833333333333333 Such as: h:mm AM to show 8:00 AM or h:mm to show 20:00 for 8:00 PM
35 08:00:00 PM 0.833333333333333
36 20:00 0.833333333333333
MOD(n, d) = n - d*INT(n/d)
n EndTime - StartTime
d 1
n - d*INT(n/d) 0.2395833333333
Formula:
J12: =D6-C6-J11*INT((D6-C6)/J11)
n - d*INT(n/d) = 2:05 AM - 8:20 PM - 1 * INT((2:05 AM - 8:20 PM)/1)
How Mod works:
https://www.youtube.com/watch?v=VcgSkLpgo6o
Excel Magic Trick 1206: Day & Night Shift Time Calculations: Add Total Hours Single Cell Formula
Night Shift Time Calculations
MOD(n, d) = n - d*INT(n/d)
n EndTime - StartTime
d 1
n - d*INT(n/d) 0.239583333333333
Formula:
C12: =D6-C6-C11*INT((D6-C6)/C11)
n - d*INT(n/d) = 2:05 AM - 8:20 PM - 1 * INT((2:05 AM - 8:20 PM)/1)
How Mod works:
https://www.youtube.com/watch?v=VcgSkLpgo6o
Excel Magic Trick 1206: Day & Night Shift Time Calculations: Add Total Hours Single Cell Formula
34
Hours Worked 5.16666666667 21 Err:509
35 Hour Wage ($) 27.55
36 Gross Pay ($) 142.34 22 Err:509
37
38 Question: StartTime 8:30 AM
Calculate Gross Pay with
39 Lunch
Lunch Break: EndTime1 12:05 PM
Break
40 StartTime2 12:30 PM
41 EndTime2 5:42 PM
42
Hours Worked 8.78333333333 23 Err:509
43
44 Question: Start End Hours Worked: Formula:
6
Mon, 1/15/2024
Difference between dates, including 1st day
= EndDate - StartDate + 1
7
Mon, 1/22/2024
Fri, 2/16/2024
10
11 Notes:
Calculate future date by adding days
12
= StartDate + NumberOfDays
Determine future date while excluding
weekends and holidays (1st day included)
13 =WORKDAY.INTL(StartDate-
1,NumberWorkDays,
WeekendNumber,HolidayAsRange)
14
15 Notes:
Calculate future date by adding days
16
= StartDate - NumberOfDays
19
Notes:
Calculate future date by adding number of
20 months with:
=EDATE(StartDate,NumberOfMonths)
Calculate end of month date with:
21
=EOMONTH(StartDate,NumberOfMonths)
For each function months can be:
22 positive (jump into future),
zero (same month as StartDate)
negative (jump into past)
23
24
25
YEAR creates the year as a number from a Serial
26
Number Date
MONTH creates the month as a number from a
27
Serial Number Date
DAY creates the day as a number from a Serial
28
Number Date
29 TEXT converts a number to text based on
30 Number Formatting Code.
31
32
33 Notes:
Number hours between two time values
34 = (EndTime - StartTime)*24. Do not round
hours.
35
36 For payroll, you need to round to the penny.
37
38
39
40
41
Number hours when there is a lunch break
42 = (EndTime1 - StartTime1 + EndTime2 -
StartTime2)*24. Do not round hours.
43
44 Notes:
If you are using date-time values, Hours Worked
45 on Night Shift =
(EndDateTime - StartDateTime)*24
Hours Worked on Night Shift = MOD(EndTime -
46
StartTime,1)*24
Hours Worked on Night Shift =
47 ((EndTime-StartTime +
(EndTime<StartTime))*24
Invoice Issue
Customer Invoice # Amount Owed Date
Rafaela Sparkman 2693 $227.66 12/7/2020
Providencia Esposito 2867 $759.31 12/21/2020
Adrien Dougherty 3092 $303.89 12/24/2020
Marvis Block 3222 $459.95 12/30/2020
Drucilla Ragsdale 3247 $574.95 1/15/2021
Senaida Battles 3319 $315.25 2/11/2021
Ossie Kimbrough 3459 $181.82 2/16/2021
Elwood Koehler 3587 $177.74 2/19/2021
Corliss Coffin 3903 $581.59 3/14/2021
Claudette Barela 3950 $761.62 3/16/2021
it took to pay the invoice and that will spill down the column.
Invoice Issue
Customer Invoice # Amount Owed Date
Rafaela Sparkman 2693 $227.66 12/7/2020
Providencia Esposito 2867 $759.31 12/21/2020
Adrien Dougherty 3092 $303.89 12/24/2020
Marvis Block 3222 $459.95 12/30/2020
Drucilla Ragsdale 3247 $574.95 1/15/2021
Senaida Battles 3319 $315.25 2/11/2021
Ossie Kimbrough 3459 $181.82 2/16/2021
Elwood Koehler 3587 $177.74 2/19/2021
Corliss Coffin 3903 $581.59 3/14/2021
Claudette Barela 3950 $761.62 3/16/2021
it took to pay the invoice and that will spill down the column.
Number Of Days to
Complete Project
Goal: In cell E5, create a formula to calcualte the number of days to complete each project.
Number Of Days to
Complete Project Formula: Goals:
70 {=D5:D14-C5:C14+1} In cell E5, create a formula
220 calcualte the number of day
250 complete each project.
198
43
55
36
233
172
238
cell E5, create a formula to
alcualte the number of days to
omplete each project.
Goal #1: Using one of Excel's Date Functions, calculate the Due Date if the invoice
contract says that the amount is due on the same day, two month's ahead.
Goal #2: Using one of Excel's Date Functions, calculate the Due Date if the
invoice contract says that the amount is due at the end of the month.
Date if the invoice
two month's ahead.
Date if the
of the month.
Goal #1: Using one of Excel's Date Functions, calculate the Due Date if the invoice
contract says that the amount is due on the same day, two month's ahead.
Goal #2: Using one of Excel's Date Functions, calculate the Due Date if the
invoice contract says that the amount is due at the end of the month.
Formula: Goals:
=EOMONTH(D11,F12) Using one of Excel's Date Functions, calculate the Due Date if the invoice
that the amount is due at the end of the month.
the Due Date if the invoice contract says
month's ahead.
Tax Rate
0.0765
Tax Rate
0.0765
Tax Rate
0.0765
Tax Rate
0.0765