- Learn
- Computer Science & IT
- Digital Skills
- Spreadsheet Formulas and Functions
- Date and Time Functions
Date and Time Functions
IntermediateLesson 5 of 7 in Spreadsheet Formulas and Functions Course
What you will learn
- Explain why every date and time in a spreadsheet is a number, enter dates and times so they are recognized, and use the current date and time in formulas.
- Treat dates as serial numbersExplain the serial number behind every date, enter dates the spreadsheet recognizes, and find the number of days between two dates.
- Work with times as fractions of a dayRead a time as a fraction of a day, build times and take them apart, and convert between time values, hours and minutes.
- Use TODAY and NOW for the current date and timeInsert the current date or date and time with TODAY and NOW, know when they update, and use them to count days until or since an event.
- Treat dates as serial numbers
- Extract the year, month, day and weekday from a date, number the weeks of the year in the two common systems, and rebuild related dates from their parts.
- Extract year, month and day and rebuild datesPull the year, month and day out of a date with YEAR, MONTH and DAY, and combine them with DATE to build related dates such as the first of the month.
- Find the day of the week with WEEKDAYReturn the day of the week as a number with WEEKDAY, choose the right numbering, and use it to flag weekends and find the start of a week.
- Number weeks with WEEKNUM and ISOWEEKNUMNumber the weeks of the year in the US-style and ISO systems, explain why they differ around the new year, and label ISO weeks with the right year.
- Extract year, month and day and rebuild dates
- Move dates by whole months, find the ends of months and quarters, and measure ages and lengths of service in completed years and months.
- Move a date by whole months with EDATEFind the same day a number of months earlier or later with EDATE, and handle month ends and schedules correctly.
- Find month and quarter ends with EOMONTHReturn the last day of a month with EOMONTH, and use it for first days, days in a month, payment terms and quarter ends.
- Calculate ages and lengths of serviceMeasure ages, lengths of service and other elapsed periods in completed years, months and days with DATEDIF.
- Move a date by whole months with EDATE
- Count the working days between two dates and find deadlines a number of working days away, with holiday lists and with weekends that match how people actually work.
- Count working days with NETWORKDAYSCount the working days in a period with NETWORKDAYS, include a holiday list, and read the result correctly.
- Find deadlines with WORKDAYFind the date a number of working days before or after a start date with WORKDAY, and avoid off-by-one errors.
- Set custom weekends with NETWORKDAYS.INTL and WORKDAY.INTLCount and schedule working days for any weekend pattern, such as a Friday–Saturday weekend or a part-time week, with the .INTL functions.
- Count working days with NETWORKDAYS
- Calculate durations between times, including breaks and night shifts, and turn time sheets into decimal hours, overtime and pay.
- Calculate durations between timesSubtract times to get durations, show totals of more than 24 hours, and handle breaks and shifts that cross midnight.
- Turn hours worked into pay and overtimeConvert time sheets into decimal hours, apply rounding rules, split regular and overtime hours, and calculate pay.
- Calculate durations between times
- Group dated records into months, quarters and weeks, and total or count them per period with date criteria.
- Group dates into months, quarters and weeksAdd a helper column that gives each date its month, quarter or week, using keys that sort and calculate correctly.
- Total and count by period with date criteriaTotal, count and average values for each month or week with SUMIFS and COUNTIFS on date ranges, and lay out a period summary table.
- Group dates into months, quarters and weeks
Date and Time Functions study guide
1Understand how spreadsheets store dates and times
Dates and times look different on a sheet, but both are numbers underneath. Understanding those numbers makes it much easier to explain a strange result, choose a useful format, and convert a time into hours. You will work with day numbers and fractions, check whether an entry is a real date, and distinguish a changing current-date formula from a fixed record of an event.
1.1 Treat dates as serial numbers
A serial number is the day number stored behind a date. In Excel's usual 1900 system, January 1, 1900 is 1 and January 1, 2026 is 46023. A date format turns the number into a calendar display. The number is what formulas calculate with.
Check the value behind the display
October 28, 2026 has serial number 46323. Change its format to General and you see 46323; change it back to a date format and you see the date again. Neither action changes the value. A calculation returning 18 may appear as "1/18/1900" if its result cell has a date format. Give a day count a Number or General format.
A date-looking entry may also be text. =ISNUMBER(A2) is TRUE for a real spreadsheet date and FALSE for text. Default alignment can offer a clue, since numbers usually align right and text left, but a manually chosen alignment can hide that clue. Applying a date format to text does not convert it.
Calculate days
Put March 15, 2026 in A2 and April 2, 2026 in B2. =B2-A2 returns 18 elapsed days. =DAYS(B2,A2) does the same job; its end date comes first. Adding 30 to A2 moves 30 calendar days forward.
An inclusive count asks how many calendar dates are covered, including both ends. July 13 through July 24, 2026 covers =B2-A2+1, or 12 days. The extra 1 belongs to the counting rule, not to every date subtraction.
Enter dates without mixing up month and day
Use =DATE(2026,10,28) inside a formula. The arguments identify the year, month, and day explicitly. Use four-digit years: =DATE(26,10,28) means October 28, 1926 in Excel.
Typed dates depend on regional settings. The text "03/04/2026" can mean March 4 or April 3. DATEVALUE converts text that the spreadsheet recognizes: =DATEVALUE("2026-10-28") returns 46323 when that text is recognized. ISO year-month-day order is the clearest text order, but DATE avoids text interpretation entirely. Some regional settings require semicolons between arguments or localized Excel function names.
Recognize a date-system mismatch
Excel's older 1904 system assigns the same date a serial number 1,462 lower. Excel normally converts pasted dates between systems. If conversion is disabled, or dates move without it, dates shift by four years and one day. A copied chart can expose this problem.
Google Sheets counts from December 30, 1899. Its serials match Excel's from March 1, 1900 onward. Excel preserves a historical compatibility error: serial 60 represents the nonexistent February 29, 1900. Its standard 1900 system supports January 1, 1900 through December 31, 9999; earlier typed dates remain text. Google Sheets also supports dates before 1900; dates before its December 30, 1899 starting point have negative serials.
Key Takeaways
- A date format changes how a serial number looks, not the number itself.
- Use
DATEwith a four-digit year for fixed dates in formulas. - Subtract dates for elapsed days; add 1 when both endpoints count.
- Check text dates with
ISNUMBERbefore relying on date calculations. - Dates moved between date systems need conversion to preserve their meaning.
1.2 Work with times as fractions of a day
A clock time is stored as a fraction of a day. One day is 1, so 6:00 AM is 0.25, noon is 0.5, and 6:00 PM is 0.75. This makes subtraction and conversion possible without a separate kind of arithmetic.
Read a date and time together
October 28, 2026 at 6:00 PM is 46323.75: 46323 identifies the day, and 0.75 identifies the time within it. For a modern date-time in A2, =INT(A2) gives the date alone. =MOD(A2,1) gives the time fraction alone. Format each result for the part it represents.
Typing "8:30" enters 8:30 AM, stored as about 0.354167. "8:30 PM" and "20:30" both enter about 0.854167. The formats h:mm AM/PM and hh:mm display that same evening value differently. Changing from a 12-hour display to a 24-hour display does not add 12 hours.
Build and inspect a clock time
TIME(hour,minute,second) combines three numbers. =TIME(8,30,0) builds 8:30 AM. HOUR, MINUTE, and SECOND reverse that process: for 8:47:30 AM, they return 8, 47, and 30.
These functions describe the clock within one day. =TIME(25,0,0) rolls past midnight and returns 1:00 AM. It does not store 25 elapsed hours. For a 25-hour duration, enter =25/24 or type "25:00" and display it with [h]:mm. Likewise, HOUR applied to 26:30 returns 2, the hour after the complete day has been removed.
Convert the unit before using the result
A day has 24 hours and 1,440 minutes. Use these relationships:
| Conversion | Formula |
|---|---|
| Time value to total hours | =A2*24 |
| Time value to total minutes | =A2*1440 |
| Decimal hours to a time value | =A2/24 |
| Minutes to a time value | =A2/1440 |
For 7:45, the minute part is 45/60 of an hour, so the total is 7.75 hours. The stored time value is 7.75/24. Multiplying it by 24 returns 7.75. Conversely, =90/1440 produces a time value that displays as 1:30.
Give decimal hours a Number or General format. If 7.75 is formatted as an ordinary clock time, the spreadsheet treats it as 7.75 days and displays the remaining 0.75 day as "18:00". The conversion can be correct while the display is misleading.
Keep decimal hours separate from minutes
The entry "7.30" is the number 7.3. In a decimal-hours column it means 7 hours plus 0.3 of an hour, or 18 minutes. Seven and a half hours is 7.5 in decimal hours or 7:30 as a time value. Label the columns "Duration" and "Decimal hours" so the expected entry is clear.
Key Takeaways
- Clock times are fractions of a 24-hour day.
- Multiply a time value by 24 for hours or 1440 for minutes.
TIMEandHOURdescribe a clock within one day, not total elapsed hours.- Format decimal hours as numbers; use
[h]:mmfor long durations.
1.3 Use TODAY and NOW for the current date and time
TODAY() returns the current date as a whole day number. NOW() returns the current date and time, including the fraction of the day. Both have empty parentheses because they take no arguments.
Understand when the value changes
These functions are volatile: their results update when the spreadsheet recalculates. They do not run as a continuously ticking clock. Excel normally recalculates when a workbook opens or relevant changes occur; manual calculation settings can delay an update. In Google Sheets, File > Settings > Calculation controls how formulas recalculate.
For a report, put the chosen date in one labeled cell. That cell can contain =TODAY() for a live report or a fixed date for a saved reporting day. Refer to it in the rest of the sheet. Changing one report-date cell then lets you check the whole report against another day.
Count down to a date
With a due date in C2, =C2-TODAY() returns calendar days remaining. On October 28, 2026, the result for December 31, 2026 is 64. A negative result means the due date has passed. Reverse the subtraction for days since a starting date: =TODAY()-B2. Display both as numbers.
An overdue flag can use =IF(TODAY()>C2,"Overdue","Open"). The strict greater-than sign means the date in C2 remains open all through its due day. If you need a count that stops at zero for future dates, use =MAX(0,TODAY()-C2).
Match the comparison to the deadline
A plain due date represents midnight at the beginning of that date. At 3:00 PM on the due day, =NOW()>C2 is already TRUE. For a rule that allows the whole due day, compare TODAY() with the plain date. For a deadline that specifies an exact time, retain the time in the deadline value and compare it with NOW().
The time alone is =NOW()-TODAY() or =MOD(NOW(),1). Apply a time format to the result. A date-only display on a cell containing NOW() hides the time fraction but does not remove it from comparisons.
Record an event with a fixed value
A received-date column must keep the date each item arrived. Filling it with =TODAY() makes old rows change to the new current date after recalculation. Enter a fixed date or paste a calculated result as a value to preserve the event.
Excel shortcuts enter fixed values. On Windows, Ctrl+; inserts the current date and Ctrl+Shift+; inserts the current time. On a Mac, Ctrl+; inserts the date and Command+; inserts the time. A fixed entry stays fixed when the workbook recalculates, while a current-date formula stays live.
Key Takeaways
TODAY()gives the current date;NOW()includes the time.- Both update on recalculation, so they cannot preserve an event timestamp.
- Use
TODAY()for a whole-day due date andNOW()for a timed deadline. - A single report-date cell makes date-based reports easier to test.
2Take dates apart and build new ones
A date can supply several useful pieces of information: a year, a month, a day number, a weekday, and a reporting week. Each answers a different question. You will extract those parts, build related dates, and choose the numbering rules that make the results meaningful. Week numbers need particular care around New Year, when an ISO week can belong to a different year from the date itself.
2.1 Extract year, month and day and rebuild dates
YEAR, MONTH, and DAY take a date apart into ordinary numbers. For October 28, 2026, they return 2026, 10, and 28. Any time attached to the date is ignored. You can inspect these parts or pass them to DATE to build a related date.
Extract a part and format it as a number
With the date in A2, enter =YEAR(A2), =MONTH(A2), or =DAY(A2). The output is no longer a full date. A result such as 2026 needs General or Number formatting; a date format would display serial 2026 as July 18, 1905.
To rebuild the first day of the same month, keep the year and month but replace the day: =DATE(YEAR(A2),MONTH(A2),1). For the October date, the result is October 1, 2026. Replacing the year with YEAR(A2)+1 builds the corresponding date in the following year, subject to DATE's rollover rules.
Learn what DATE does with overflow
DATE accepts month and day numbers outside their usual range and carries them into neighboring months or years. =DATE(2026,14,1) becomes February 1, 2027. Day 0 means the day before the first: =DATE(2026,3,0) becomes February 28, 2026.
This feature is useful for boundaries, but it changes a naive month-shift formula. =DATE(2026,2,31) asks for the 31st day starting in February. Since February has only 28 days, the result is March 3, 2026. To move January 31 forward one month and keep the result in February, use EDATE, which returns February 28.
Build reporting parts
A calendar quarter contains three months. =ROUNDUP(MONTH(A2)/3,0) returns 1 through 4: August gives 3 and October gives 4. Dividing the month by 3 identifies the quarter boundary, and rounding up assigns intermediate months to that quarter.
For a fiscal year beginning July 1 and named for its ending year, use =YEAR(EDATE(A2,6)). Moving August 14, 2026 forward six months places it in 2027, the fiscal-year label. The six-month shift reflects this particular July-start rule.
MONTH(A2) alone cannot distinguish October 2025 from October 2026. Both are 10. A date key such as the first of the month keeps the year available for sorting and grouping.
Choose a label or a date value
=TEXT(A2,"mmmm") returns "October", "mmm" returns "Oct", and "yyyy-mm" returns "2026-10". TEXT produces a label, not a date serial. Keep the original date or a date key for later arithmetic; use a custom number format to change its appearance while retaining its value. Format codes follow the spreadsheet's language settings.
For a date-time, equality with a plain date succeeds only at midnight. =INT(A2)=DATE(2026,10,28) tests the calendar day while ignoring the time. Simply hiding the time with a date format leaves it in the comparison.
Key Takeaways
YEAR,MONTH, andDAYreturn numbers, so format their results as numbers.DATEcan rebuild a date from selected parts.- Out-of-range DATE arguments roll into neighboring months or years.
- Keep both year and month when grouping records from several years.
TEXTcreates labels; number formats preserve date values.- Use
INTto compare the date part of a modern date-time.
2.2 Find the day of the week with WEEKDAY
WEEKDAY returns a number for the day of the week. The number has meaning only alongside its return type, which defines where the week starts and whether the numbering begins at 0 or 1.
Choose the numbering before interpreting it
| Return type | Monday | Sunday | Numbering |
|---|---|---|---|
| Omitted or 1 | 2 | 1 | Sunday 1 through Saturday 7 |
| 2 | 1 | 7 | Monday 1 through Sunday 7 |
| 3 | 0 | 6 | Monday 0 through Sunday 6 |
For Wednesday, October 28, 2026, =WEEKDAY(A2) returns 4. =WEEKDAY(A2,2) returns 3, and =WEEKDAY(A2,3) returns 2. These are three valid descriptions of the same date.
Types 11 through 17 also number days 1 through 7. Type 11 starts on Monday, type 12 on Tuesday, and the sequence continues through type 17, which starts on Sunday. An explicit return type makes the intended calendar easier to read in a formula.
Flag a Saturday–Sunday weekend
With Monday-first type 2, Saturday is 6 and Sunday is 7. The test =WEEKDAY(A2,2)>5 is TRUE on those two days. Removing the return type changes the rule: default numbering makes Friday 6, Saturday 7, and Sunday 1. The same greater-than test would then flag Friday and Saturday and miss Sunday.
For a name instead of a number, =TEXT(A2,"dddd") returns "Wednesday" and "ddd" returns "Wed". Applying the custom format dddd to the original date also displays the name, while preserving the date serial for calculations.
Find the start of a week
For Monday-first weeks, =INT(A2)-WEEKDAY(A2,2)+1 finds the Monday on or before A2. Wednesday has number 3, so subtracting 3 reaches Sunday and adding 1 reaches Monday. October 28, 2026 therefore maps to October 26.
For Sunday-first weeks, use =INT(A2)-WEEKDAY(A2)+1. The result for that Wednesday is October 25. INT removes any time before the subtraction; otherwise a Wednesday afternoon would map to a Monday afternoon, not the plain Monday date used as a grouping key.
Find the next named weekday
=A2+MOD(5-WEEKDAY(A2,2),7) finds Friday on or after a plain date. Friday is 5 in type 2. MOD turns the gap into a number from 0 through 6, so the formula stays on Friday when A2 is already Friday and moves forward six days when A2 is Saturday.
From October 28, 2026 it reaches October 30. From October 31 it reaches November 6. Replace 5 with another Monday-first weekday number to change the target. WEEKDAY helps describe or align a single date; NETWORKDAYS and WORKDAY handle counting or skipping working days over a period.
Key Takeaways
- Read the return type before interpreting a WEEKDAY result.
WEEKDAY(A2,2)>5identifies Saturday and Sunday.- A week-start formula subtracts the weekday offset from the plain date.
- MOD can find the next occurrence of a weekday, including today.
2.3 Number weeks with WEEKNUM and ISOWEEKNUM
A week number depends on two choices: the first day of the week and the rule for week 1. Choosing Monday as the first day does not by itself create ISO weeks. A reporting key must follow both rules consistently.
Compare the two main systems
| System | First day | Week 1 |
|---|---|---|
Default WEEKNUM | Sunday | The week containing January 1 |
WEEKNUM(A2,2) | Monday | The week containing January 1 |
ISOWEEKNUM(A2) | Monday | The week containing the first Thursday |
ISO week 1 is also the week containing January 4. =WEEKNUM(A2,21) gives the ISO number too. WEEKNUM return types 2 and 11 through 16 change the starting weekday but retain the January 1 rule.
Under default WEEKNUM, Friday and Saturday, January 1–2, 2027 are week 1. Sunday, January 3 begins week 2. The first week can therefore be only part of a seven-day week within the calendar year.
Follow a week across New Year
ISO weeks always contain seven days. Friday, January 1, 2027 belongs to ISO week 53 of 2026 because its week's Thursday is December 31, 2026. Monday, December 29, 2025 belongs to ISO week 1 of 2026 because its Thursday is January 1, 2026.
The default WEEKNUM results for those dates are 1 and 53. In the middle of a year the systems may also disagree: June 15, 2027 gives default week 25 and ISO week 24. October 28, 2026 happens to give 44 in both systems. Agreement on one test date does not establish that two formulas use the same rule.
Put the ISO year in the key
ISOWEEKNUM returns only the week number. Pairing it with the ordinary calendar year can split one week into two groups around New Year. Find the ISO year from the Thursday of the same week:
=YEAR(A2-WEEKDAY(A2,2)+4)
Subtracting the Monday-first weekday number and adding 4 lands on Thursday. For January 1, 2027, YEAR of that Thursday is 2026. A complete label is:
=YEAR(A2-WEEKDAY(A2,2)+4)&"-W"&TEXT(ISOWEEKNUM(A2),"00")
It returns "2026-W53". The two-digit format keeps week 2 as "02", which lets year-week labels sort in time order. YEAR(A2) would create "2027-W53" for January 1, an incorrect label for that date.
Know when a year has an extra week
An ISO year has 52 or 53 weeks. It has 53 if January 1 is Thursday, or if it is a leap year beginning on Wednesday. The year 2026 begins on Thursday and has 53 ISO weeks. Default WEEKNUM always reaches 53 and can reach 54 in a leap year beginning on Saturday; December 31, 2028 is an example. Keep the week rule with the report's labels so a number such as 53 is interpreted correctly.
Key Takeaways
- Default WEEKNUM uses Sunday starts and the week containing January 1.
- ISO weeks start Monday; week 1 contains the first Thursday.
WEEKNUM(A2,2)is Monday-first but does not use the ISO week-1 rule.- Label ISO weeks with the ISO year, found from the week’s Thursday.
- Pad week numbers to two digits in sortable text keys.
3Calculate with months, years and ages
Calendar rules often name months or completed years instead of a fixed number of days. A renewal on the same day next month, a month-end payment, and an age on a reference date need different calculations. You will choose between month shifts, month ends, and completed periods, then handle short months and birthdays without losing the meaning of the original rule.
3.1 Move a date by whole months with EDATE
EDATE(start_date,months) moves a date by whole calendar months. Positive months move forward and negative months move backward. It keeps the original day number when that day exists in the target month.
Move by months, not a fixed day count
From May 15, 2026, =EDATE(A2,6) returns November 15, 2026. From the same starting date, =EDATE(A2,-3) returns February 15. The returned value is a serial number, so give it a date format.
Months do not all have the same length. From January 31, 2026, adding 30 days gives March 2. Moving one month with EDATE gives February 28. A rule saying "30 days after the invoice" needs addition; "one month after the invoice" needs a calendar-month shift.
Handle a day that the target month lacks
If the target month has no matching day, EDATE returns its last day. January 31 plus one month becomes February 28 in 2026 and February 29 in 2028. March 31 plus one month becomes April 30. August 31, 2026 minus six months becomes February 28.
A year is 12 months, so five years after A2 is =EDATE(A2,60). Moving February 29, 2028 forward 12 months gives February 28, 2029.
EDATE truncates fractional month arguments. =EDATE(A2,2.9) moves two months, not nearly three. Enter a whole number of months when building a schedule so the intended interval is visible.
Anchor every date in a repeating schedule
Suppose a subscription starts January 31, 2026. The first monthly date is February 28. If the next formula moves that February result one month forward, it returns March 28. The original 31st has been lost.
Keep the original date in A2. Put month offsets 1, 2, 3, and so on in B5 downward, and enter =EDATE($A$2,B5) next to B5. Copy the formula down. The locked start stays January 31, while each row supplies its own offset. The dates become February 28, March 31, and April 30.
For a schedule specifically requiring the last day of every month, EOMONTH expresses the rule more directly. EDATE preserves a day number when possible; it does not turn every starting date into a permanent month-end rule.
Match the endpoint wording
A six-month contract beginning May 15, 2026 and ending the day before its six-month anniversary uses =EDATE(A2,6)-1, giving November 14. A renewal occurring on that anniversary uses EDATE without subtracting 1. Write the timing rule next to the input cells before choosing the adjustment.
Key Takeaways
- EDATE moves by calendar months and preserves the day number when possible.
- A missing target day becomes the target month’s last day.
- Use the original date plus each offset to prevent schedule drift.
- Choose day addition or EDATE from the deadline’s stated unit.
3.2 Find month and quarter ends with EOMONTH
EOMONTH(start_date,months) returns the last day of the selected month. The months argument chooses the month relative to the starting date. It does not preserve the starting day number.
Locate a month boundary
With February 10, 2026 in A2, =EOMONTH(A2,0) returns February 28. An offset of 1 returns March 31, and −1 returns January 31. The result needs a date format. Fractional offsets are truncated, just as they are in EDATE.
The first day of a month is one day after the previous month's end. =EOMONTH(A2,-1)+1 returns February 1 for any date in February. =EOMONTH(A2,0)+1 returns March 1. To find the number of days in the original month, use =DAY(EOMONTH(A2,0)): February gives 28 in 2026 and 29 in 2028.
Translate payment terms carefully
An April 12, 2026 invoice can have three different due dates:
| Wording | Formula | Result |
|---|---|---|
| "30 days after the invoice" | =A2+30 | May 12 |
| "30 days after month end" | =EOMONTH(A2,0)+30 | May 30 |
| "End of the following month" | =EOMONTH(A2,1) | May 31 |
The first calculation starts from the invoice date. The second first moves to April 30 and then adds days. The third moves to the last day of May. A month offset and a day offset are different operations even when two results happen to be close.
Find a calendar quarter's final date
For August 14, 2026, MONTH returns 8. Dividing by 3 and rounding up gives quarter 3. Multiplying that quarter by 3 gives 9, the final month of the quarter. Build a date in September and move to its end:
=EOMONTH(DATE(YEAR(A2),ROUNDUP(MONTH(A2)/3,0)*3,1),0)
The result is September 30, 2026. The same pattern handles all four calendar quarters without a table of different month lengths.
A month-end schedule also stays simple. From January 31, 2026, offsets 0, 1, 2, and 3 in EOMONTH give January 31, February 28, March 31, and April 30. Starting on January 30 produces those same month ends. EDATE would instead try to keep the 30th.
Include timestamps on the final day
EOMONTH returns midnight at the start of the last day. October 31, 2026 at 2:00 PM is later than the plain October 31 date. A condition testing whether that timestamp is less than or equal to the month end misses it.
Use the first instant of next month as an exclusive upper boundary: "<"&EOMONTH(A2,0)+1. Combine it with an inclusive lower boundary at the first of the current month. Every time on the final day then fits, and midnight at the start of the following month does not.
Key Takeaways
- EOMONTH returns a month’s last day; offset 0 means the current month.
- Add 1 to a month end to reach the next month’s first day.
- Payment terms determine whether to add days or move to a month end.
- Quarter ends come from the quarter’s final month.
- For timestamps, use an exclusive boundary at the next month’s start.
3.3 Calculate ages and lengths of service
An age counts completed years, not just the difference between two year numbers. DATEDIF(start_date,end_date,unit) measures completed periods between two dates. The unit is text in straight quotation marks.
Choose the period you need
| Unit | Result |
|---|---|
"Y" | Complete years |
"M" | Complete months in total |
"D" | Days between the dates |
"YM" | Months remaining after complete years |
"YD" | Days remaining after complete years |
The start must not be later than the end; reversed dates return #NUM!. For a simple number of days, subtraction or DAYS is sufficient. DATEDIF also works in Google Sheets; Excel retains it for compatibility with older workbooks.
Calculate an age on a chosen date
Put August 20, 1990 in B2 and October 28, 2026 in C2. =DATEDIF(B2,C2,"Y") returns 36. Using "YM" returns 2 months, while "M" returns 434 total completed months. The total months contain all the completed years as well as the extra months.
For someone born November 5, 1990, the same reference date gives 35 complete years. The birthday is still ahead. =YEAR(C2)-YEAR(B2) would return 36 because it never checks the month and day.
Dividing elapsed days by 365 is also unreliable for completed ages because leap days affect the quotient. Someone born October 30, 2000 is still 25 on October 28, 2026 even though the elapsed-days quotient is about 26.01. DATEDIF with "Y" counts complete years.
Show service as years and months
For a hire date of June 15, 2021 and the reference date October 28, 2026, use:
=DATEDIF(B2,C2,"Y")&" years, "&DATEDIF(B2,C2,"YM")&" months"
The label is "5 years, 4 months". Use YM for the second part; M would repeat the months already represented by the five years. To calculate an age at a season's fixed cutoff, put that cutoff in C2 or use a fixed DATE, such as DATE(2026,12,31), instead of TODAY.
Find leftover days without MD
The "MD" unit can return inaccurate results, so calculate the remaining days from the completed-month anniversary:
=C2-EDATE(B2,DATEDIF(B2,C2,"M"))
From August 20, 1990 to October 28, 2026, the complete-month count reaches October 20. Subtracting that from October 28 leaves 8 days. The full label is 36 years, 2 months, and 8 days.
For an age-threshold test, compare the anniversary with the reference date: =EDATE(B2,12*18)<=C2. It becomes TRUE on the 18th anniversary. A birth date of November 5, 2008 gives FALSE on October 28, 2026 because the November anniversary has not arrived.
Key Takeaways
- Use DATEDIF with
"Y"for completed years. "M"counts all completed months;"YM"counts months after complete years.- Year subtraction ignores birthdays, and dividing by 365 drifts with leap days.
- Use a fixed reference date when the age rule has a fixed cutoff.
- Find leftover days by subtracting the completed-month anniversary instead of using MD.
- Compare an age anniversary with the reference date to test an age threshold.
4Count and schedule working days
A working-day calculation needs a calendar of the days people actually work. Counting available days and finding a deadline are related tasks, but they treat the starting date differently. You will use holiday lists, move forward and backward through a schedule, and adapt the weekend pattern for teams whose working week differs from Monday through Friday.
4.1 Count working days with NETWORKDAYS
NETWORKDAYS(start_date,end_date,[holidays]) counts working days in a period. Its ordinary weekend is Saturday and Sunday. It includes both endpoints when they are working days and excludes listed holidays that would otherwise count.
Count a period with both ends included
From Monday, November 2 through Friday, November 27, 2026 there are four complete Monday-to-Friday blocks: 20 working days. If Thursday, November 26 is a company holiday in H2:H12, =NETWORKDAYS(A2,B2,$H$2:$H$12) returns 19.
From Monday through Friday in the same week, the function returns 5. With the same working day as both start and end, it returns 1. That differs from ordinary subtraction, which measures the gap between dates. July 13 through July 24, 2026 covers 12 calendar dates but 10 working days with no holidays.
Maintain a usable holiday list
Enter each holiday as a real date in its own cell. Use a locked range such as $H$2:$H$12 when copying formulas, or define a named range called Holidays. A relative holiday range would slide down as each formula is copied, possibly dropping a relevant holiday from the calculation.
Use the holiday calendar that applies to the organization. A listed Saturday or Sunday does not remove another working day: it was already excluded as a weekend. November 2 through November 30, 2026 has 21 working days, and adding Saturday, November 28 to the holiday list leaves the result at 21.
Decide whether today belongs in the count
For a deadline later than today in C2, =NETWORKDAYS(TODAY(),C2,Holidays) includes today if it is a working day. If the rule asks for working days after today, begin tomorrow: =NETWORKDAYS(TODAY()+1,C2,Holidays).
Subtracting 1 from the first result is not a safe replacement. On a Saturday, today contributed nothing to the first count. Subtracting 1 would then remove an actual future working day. Changing the starting date expresses the intended rule whether today is working or nonworking.
Diagnose unexpected results
A negative result means the start lies after the end. Reversing the November example with the November 26 holiday returns −19. Check the input order before interpreting that as available time.
#VALUE! often points to a date stored as unrecognized text. Check the inputs with ISNUMBER and create fixed dates with DATE. A number such as 19 displayed as a January 1900 date is a formatting problem; a working-day count needs a Number or General format.
NETWORKDAYS answers "How many working days are in this interval?" It returns a count. To answer "What date is five working days after receipt?", use WORKDAY, which returns a date and starts counting after receipt.
Key Takeaways
- NETWORKDAYS includes both endpoints when they are working days.
- Keep holidays as real dates in a fixed or named range.
- A weekend holiday is not deducted twice.
- To exclude today, begin at
TODAY()+1for a later deadline. - NETWORKDAYS returns a count; WORKDAY returns a date.
4.2 Find deadlines with WORKDAY
WORKDAY(start_date,days,[holidays]) finds a date a stated number of working days away. Positive days move forward, negative days move backward. Saturday, Sunday, and listed holidays are skipped, and the start date itself is not counted.
Step forward through a deadline
Start on Friday, October 30, 2026. With no holidays, the five counted days are Monday, November 2 through Friday, November 6. =WORKDAY(A2,5) returns November 6. Apply a date format so the result reads as a deadline.
If Monday, November 2 is a holiday, the first counted day is Tuesday, November 3. Day five is now Monday, November 9. =WORKDAY(A2,5,Holidays) makes that adjustment from the holiday list.
The wording "five working days after receipt" matches WORKDAY directly. NETWORKDAYS from October 30 to November 6 returns 6 because it includes the receipt Friday as well as the following five workdays. Substituting a count function for a scheduling function creates an off-by-one error.
Work backward from a due date
A report is due Friday, December 18, 2026 and needs 10 working days of preparation before that date. =WORKDAY(C2,-10) returns Friday, December 4. If Tuesday, December 8 is a holiday, the backward count skips it and reaches Thursday, December 3.
Negative days are useful for "send a reminder three working days before" and "begin preparation ten working days before" rules. Keep the due date in its own input cell so revised deadlines flow into the preparation dates.
Move to a valid date on or after a target
A weekend start is allowed. One working day after Saturday, October 31, 2026 is Monday, November 2. But =WORKDAY(A2,1) always asks for a working day after A2; it also moves a valid weekday forward.
To keep A2 when it is already a working day and move it forward only when needed, use =WORKDAY(A2-1,1,Holidays). Beginning one day earlier allows A2 to be counted as the first eligible day.
A combined invoice rule says, "Due 30 calendar days after the invoice, moved to the next working day if necessary." First form the target A2+30, then apply the on-or-after pattern:
=WORKDAY(A2+30-1,1,Holidays)
For an October 1, 2026 invoice with no holidays, day 30 is Saturday, October 31. The adjusted date is Monday, November 2. Adding 30 working days would be a different rule and a much later deadline.
Check the input unit
WORKDAY counts whole days and truncates a fractional days argument. A value of 5.8 means five working days, not five days and part of a shift. Invalid date arguments can return #VALUE!; a result outside the supported date range returns #NUM!. Store the dates and the number of working days in separately labeled cells.
Key Takeaways
- WORKDAY excludes the start date and skips weekends and holidays.
- Negative days schedule backward from a deadline.
WORKDAY(A2-1,1,Holidays)finds a working day on or after A2.- Calculate calendar-day targets before applying a working-day adjustment.
4.3 Set custom weekends with NETWORKDAYS.INTL and WORKDAY.INTL
Not every team has Saturday and Sunday off. NETWORKDAYS.INTL and WORKDAY.INTL let you specify a repeating weekly pattern of nonworking days. They retain the ordinary functions' endpoint rules and accept a holiday list after the weekend argument.
Place the weekend argument correctly
The counting form is NETWORKDAYS.INTL(start_date,end_date,[weekend],[holidays]). The scheduling form is WORKDAY.INTL(start_date,days,[weekend],[holidays]). Omit the weekend argument for Saturday–Sunday. Use a code or a seven-character text string to choose another pattern.
| Code | Days off |
|---|---|
| 1 | Saturday–Sunday |
| 2 | Sunday–Monday |
| 3 | Monday–Tuesday |
| 4 | Tuesday–Wednesday |
| 5 | Wednesday–Thursday |
| 6 | Thursday–Friday |
| 7 | Friday–Saturday |
For one day off, 11 means Sunday only, 12 Monday only, and the sequence continues through 17 for Saturday only. The code is a calendar choice, not the number of days off.
Describe a part-time week with a string
A weekend string has seven positions, starting with Monday. A 1 means a day off and a 0 means a working day. "0000011" means Saturday–Sunday off. "0000110" means Friday–Saturday off, leaving Sunday as a working day.
For someone working Monday, Tuesday, Thursday, and Friday, the string is "0010011": Wednesday, Saturday, and Sunday are off. In November 2026 this gives 17 working days before any holidays are removed. The pattern repeats every week; individual extra closure dates belong in the holiday list.
Keep the string in quotation marks or in a text cell. Entering 0000011 as a number turns it into 11, which the function reads as the Sunday-only code. Check the direction of the bits too: reversing 0 and 1 reverses which days are eligible.
See how a changed weekend changes the answer
November 2026 has 21 working days under Saturday–Sunday weekends. With Friday–Saturday weekends, =NETWORKDAYS.INTL(DATE(2026,11,1),DATE(2026,11,30),7) returns 22. With Sunday as the only day off, code 11 gives 25. The same endpoints can produce different valid counts because the working calendars differ.
For a Friday–Saturday weekend, =WORKDAY.INTL(DATE(2026,11,5),3,7) starts after Thursday, November 5. It skips Friday and Saturday, then counts Sunday, Monday, and Tuesday. The result is Tuesday, November 10.
Check a pattern before copying it
A string must contain exactly seven 0s and 1s. A wrong length or another character returns #VALUE!. "1111111" excludes every day, so NETWORKDAYS.INTL returns 0. Test a short interval against the team's calendar, then lock the weekend input and holiday range when copying formulas. This catches a reversed pattern before it affects a long schedule.
Key Takeaways
- The .INTL functions accept a weekend code or seven-character text pattern.
- Weekend strings run Monday through Sunday; 1 means off and 0 means working.
- Keep strings as text so leading zeros survive.
- Holiday dates are a separate input after the weekend pattern.
- The same date range can have different working-day counts under different calendars.
5Calculate time differences and hours worked
Time sheets combine clock readings, elapsed durations, and decimal hours. Keeping these quantities clear lets you handle breaks, overnight work, and totals that exceed a day. You will calculate the time first, convert it to hours for pay, and apply stated overtime and rounding rules through labeled inputs. The examples use currency-neutral rates and explicit example pay rules.
5.1 Calculate durations between times
A duration measures elapsed time. Subtract the start from the end to get it. The spreadsheet stores the result in days, even when a time format displays hours and minutes.
Subtract a same-day shift and its break
With 8:30 AM in B2 and 5:15 PM in C2, =C2-B2 gives 8:45, stored as about 0.364583 day. A 45-minute break entered as 0:45 in D2 gives =C2-B2-D2, or 8:00. Enter the break in the same time-value form as the shift duration.
For an interval from 9:40 AM to 11:05 AM, =(C2-B2)*1440 returns 85 minutes. Multiplying by 24 instead gives total decimal hours. A result formatted as Number is easier to interpret after either conversion.
Display every hour in a long total
Five durations of 8:45 total 43:45. An ordinary h:mm format displays 19:45 because it shows the clock after complete days are removed. The format [h]:mm displays all 43 hours and 45 minutes. Its square brackets are part of the time-format code.
The display format does not repair an incorrect calculation. Check the underlying value first, then choose [h]:mm for elapsed totals or Number for decimal hours. A 43:45 total is 43.75 hours, not 43.45.
Handle a shift that crosses midnight
A time-only end of 6:30 AM is numerically smaller than a time-only start of 10:00 PM. Plain subtraction gives a negative fraction. In Excel's standard date system, a negative time often appears as a row of hash marks.
For a shift known to last less than 24 hours, =MOD(C2-B2,1) wraps a negative difference into the next day and gives 8:30. =IF(C2<B2,C2+1-B2,C2-B2) makes the same adjustment explicitly. Subtract any break after that shift calculation.
These formulas cannot distinguish a zero-length interval from one lasting a whole day when the clock readings match. They also discard complete days from longer intervals. Record dates as well as times when the duration can reach 24 hours.
Use complete date-times for longer intervals
A start of October 28, 2026 at 10:00 PM and end of October 29 at 6:30 AM subtract correctly without MOD. The end's whole-day number is one larger, so it already carries the midnight crossing.
A support ticket opened October 26, 2026 at 9:15 AM and closed October 28 at 2:45 PM lasts 53:30. Subtract the complete date-times and display [h]:mm, or multiply the difference by 24 to get 53.5 hours.
Do not use HOUR to retrieve the total from this duration: it returns 5, the clock-hour remainder. =TEXT(A2,"h:mm") similarly gives "5:30", while =TEXT(A2,"[h]:mm") gives "53:30" as a text label. For further calculation, keep the numeric duration and change its number format instead of converting it to text.
Key Takeaways
- Subtract start from end, then subtract breaks as time values.
- Use
[h]:mmto display elapsed totals over 24 hours. - MOD handles an overnight time-only shift when it lasts less than 24 hours.
- Complete date-times preserve midnight crossings and full days.
- Multiply durations by 24 or 1440 for total hours or minutes.
- HOUR reads the clock-hour remainder, not a duration’s total hours.
5.2 Turn hours worked into pay and overtime
An hourly rate multiplies a number of hours. A spreadsheet time value is measured in days, so convert it before calculating pay. Keep duration and decimal-hours columns separate to make the units visible.
Build a daily hours column
Use one row per shift: date, start, end, break, and decimal hours. For a same-day shift from 8:30 AM to 5:15 PM with a 0:45 break, =(C2-B2-D2)*24 returns 8. For overnight shifts under 24 hours, calculate the wrapped shift before subtracting the break, then multiply by 24. Complete date-times can be subtracted directly.
Five shifts of 8:45 total 43:45. You can sum the durations and multiply once by 24, or sum a decimal-hours column. Both give 43.75 hours. Do not multiply a decimal-hours total by 24 again.
Convert before applying the rate
A total of 37:30 is stored as 1.5625 days. At a rate of 18.40 per hour, the correct calculation is 37.5 hours times 18.40, giving 690.00. Multiplying 1.5625 directly by the hourly rate gives 28.75 because the calculation used days as if they were hours.
Give rates and pay a Number format with suitable decimal places. A label such as "Hours (decimal)" beside a value of 37.5 distinguishes it from the duration display "37:30".
Split regular and overtime hours
For an example threshold of 40 hours and multiplier of 1.5, with total decimal hours in H2:
- Regular hours:
=MIN(H2,40). - Overtime hours:
=MAX(0,H2-40).
MIN caps regular hours at 40. MAX prevents overtime from becoming negative in a shorter week. At 43.75 hours, the split is 40 regular and 3.75 overtime hours. At a rate of 18.40, regular pay is 736.00 and overtime pay is 103.50, giving 839.50.
In a reusable sheet, replace 40 and 1.5 with references to the labeled input cells. Thresholds, multipliers, and rounding rules come from the applicable contract or local rules; the example numbers are inputs for this calculation.
Apply the specified rounding rule
For decimal hours, nearest-quarter-hour rounding is =ROUND(H2*4,0)/4. Multiplying by 4 expresses hours in quarter-hour units; rounding selects the nearest whole unit, and dividing by 4 converts back to hours. At 7:53, or about 7.8833 hours, the result is 8.00.
=ROUNDDOWN(H2*4,0)/4 always rounds positive hours down, giving 7.75 for the same record. On a time value, =MROUND(A2,1/96) rounds to the nearest 15 minutes, since 96 quarter hours fill a day.
Keep unrounded amounts through the pay calculation and use =ROUND(pay,2) at the end for cents. Showing two decimals changes the display; ROUND changes the value used in later totals.
Key Takeaways
- Convert time values to decimal hours before multiplying by an hourly rate.
- Sum either durations or decimal hours with consistent units.
- MIN caps regular hours; MAX keeps overtime hours at zero or above.
- Keep the threshold, rate, and multiplier in labeled input cells.
- Nearest-quarter rounding and rounding down are different rules.
- Round the final pay amount to two decimal places when pay uses cents.
6Build weekly and monthly summaries
Dated records become useful reports when every row falls into a clearly defined period. A month label alone can hide a year, and a last-day cutoff can miss records with times attached. You will create keys for months and weeks, then build totals and counts with boundaries that include every intended record. The same structure can support a copied summary table and working-day averages.
6.1 Group dates into months, quarters and weeks
A period key gives every record in the same reporting period the same value. It belongs in a helper column beside the original date or timestamp. A good key keeps the year and sorts in time order.
Give each month a real date key
=EOMONTH(A2,-1)+1 returns the first day of A2's month. =DATE(YEAR(A2),MONTH(A2),1) gives the same result. Every October 2026 record receives October 1, 2026, whether it occurred on the first or last day and regardless of its time.
Format that column as mmm yyyy to show "Oct 2026". The stored key remains a date. It sorts chronologically and can move to the next month with EDATE. MONTH(A2) alone would group October 2025 with October 2026.
A text key such as =TEXT(A2,"yyyy-mm") also sorts correctly because it places the four-digit year first and pads the month to two digits. A name such as "Oct" loses the year; a label such as "Oct 2026" sorts alphabetically when it is text. Formatting a real date as "Oct 2026" avoids that problem.
Give each week its starting date
For Monday-first weeks, use =INT(A2)-WEEKDAY(A2,2)+1. For Sunday-first weeks, use =INT(A2)-WEEKDAY(A2)+1. Wednesday, October 28, 2026 maps to Monday, October 26 or Sunday, October 25, depending on the rule.
INT removes the time fraction before finding the week start. Without it, a 9:00 AM record and a 4:30 PM record can receive different values on the same Monday. They may look identical under a date-only format while failing an equality test. For daily grouping, =INT(A2) alone supplies the date key.
Label quarters and ISO weeks
A calendar-quarter label can use =YEAR(A2)&"-Q"&ROUNDUP(MONTH(A2)/3,0). October through December 2026 all receive "2026-Q4". Including the year keeps different years' fourth quarters apart.
For ISO reports, use both the ISO year and ISO week number:
=YEAR(A2-WEEKDAY(A2,2)+4)&"-W"&TEXT(ISOWEEKNUM(A2),"00")
The Thursday in the week determines the ISO year. January 1, 2027 therefore receives "2026-W53". Ordinary YEAR paired with ISOWEEKNUM would split this week at New Year. The two-digit week number also keeps text sorting in order.
Treat weeks and months as different groupings
The week beginning Monday, September 28, 2026 continues through Sunday, October 4. Its records belong to two different months. A week-start key places all of them in one weekly group, while month keys separate them at October 1.
A monthly total must select the dates in that month. Assigning whole weekly totals to the month of their start can pull October records into September and omit records from a week beginning in the previous month. Build each report from the dated records using its own boundaries.
Key Takeaways
- Date keys such as the first of the month preserve years and sort chronologically.
- Remove time fractions before creating daily or weekly equality keys.
- ISO week labels need the ISO year and a two-digit week number.
- Weekly groups can cross month boundaries, so build monthly groups from dates.
6.2 Total and count by period with date criteria
A period total needs two date conditions: on or after the period's start, and before the next period's start. This includes every timestamp inside the period without guessing its final time of day.
Build a monthly total
Suppose A2:A8 holds dates and C2:C8 holds amounts. Put October 1, 2026 in E2. The total is:
=SUMIFS(C2:C8,A2:A8,">="&E2,A2:A8,"<"&EDATE(E2,1))
SUMIFS starts with the values to add, then pairs each criteria range with its condition. Both conditions use the date column. The first accepts October 1 onward; the second rejects November 1 onward. The ampersand joins the quoted comparison operator to the date value. Writing ">=E2" keeps E2 inside text instead of reading the cell.
For amounts of 120 on September 28, 80 on September 30, 150 on October 1, 60 on October 2, 200 on October 5, 90 on October 30, and 40 on November 2, the October total is 500. Only the four October records contribute.
Count matching records or change the period
=COUNTIFS(A2:A8,">="&E2,A2:A8,"<"&EDATE(E2,1)) returns 4. COUNTIFS has no sum range because it counts matching rows. Every condition must hold for the same row.
For a weekly total, put Monday, September 28 in E2 and replace the upper boundary with E2+7:
=SUMIFS(C2:C8,A2:A8,">="&E2,A2:A8,"<"&E2+7)
That week totals 410 from September 28, September 30, October 1, and October 2. The week crosses a month boundary, so its total cannot simply be assigned to October.
Protect the final day's timestamps
The plain date October 31 means midnight at its start. A record at 2:00 PM is larger. Testing "<=" against October 31 would omit it. Testing "<" against November 1 includes it while excluding the next month exactly at midnight.
Create boundary dates with DATE, EDATE, EOMONTH, or date cells. A typed criterion such as ">=10/1/2026" depends on regional date interpretation. Separating the operator from a real date avoids that ambiguity.
Copy a summary table
For monthly rows, begin with =DATE(2026,1,1) in E2 and use =EDATE(E2,1) below it. For Monday-based weeks spanning that year, begin December 29, 2025, then add 7 on each row. January 1, 2026 is a Thursday, so adding 7 from that date would create Thursday-starting periods.
Lock the source ranges in the copied total, such as $C$2:$C$8 and $A$2:$A$8, while leaving E2 relative. Each row then changes its boundary without shifting the source data. If a helper column already contains a month key, equality is enough: =SUMIFS(C2:C8,D2:D8,E2).
For an average per working day, divide the total by NETWORKDAYS over the month, including applicable holidays. October 2026 has 22 Monday-to-Friday days before holidays, so 500 gives about 22.73 per working day. For month-to-date reporting, use the month's first day as the lower boundary and "<"&TODAY()+1 as the upper boundary to include all of today.
Key Takeaways
- Use an inclusive start and an exclusive next-period start for date criteria.
- Join quoted operators to date cells with
&. - SUMIFS adds matching values; COUNTIFS counts matching rows.
- Lock source ranges and let the summary row’s period cell move when copying.
- Use real week starts in weekly tables and real month starts in monthly tables.
- A helper period key can replace two boundary conditions with one equality.
- Divide by working days for a working-day average, not by the number of records.
Date and Time Functions examples
1Read the numbers behind dates and times
13 steps
- 1IntroductionStart with the stored number
A schedule can show a calendar date, a clock time, and a day count next to one another. Underneath, all three are numbers. You will inspect those values, convert their units, and choose a current-date formula only when the result should change.
Keep a cell's value separate from its display as you work: changing the display cannot repair the wrong value.
- 2ExplanationReveal a date serial
October 28, 2026 is serial 46323 in Excel's usual date system. A date format makes it look like a calendar date; General makes it show 46323.
The value is unchanged in both displays. That is why adding 1 moves to the following date and subtracting two dates gives a number of days. A day count needs a Number format so it does not look like an early-1900 date.
- 3ExampleCount elapsed or included dates
Put March 15, 2026 in A2 and April 2 in B2. The formula
=B2-A2gives 18 elapsed days.If a booking includes both the starting and ending dates, the count is
=B2-A2+1, or 19 calendar dates. Decide what is being counted before adding the extra day. It belongs to an inclusive count, not to ordinary elapsed-time subtraction. - 4ChallengeFind the entry problem
An imported cell looks like a date, but
ISNUMBER(A2)is FALSE. Applying a date format leaves the problem. What needs to change?---reveal---
The cell needs conversion from text to a numeric date. Use DATE to build the intended date from its parts, or DATEVALUE when the text is recognized. Formatting only changes the appearance of a value; it does not turn date-looking text into a date serial.
- 5ExplanationMeasure the part of a day
A time is a fraction of a day: 6:00 AM is 0.25, noon is 0.5, and 6:00 PM is 0.75. A date-time adds the fraction to its day number.
October 28, 2026 at 6:00 PM is 46323.75.
INT(A2)retrieves 46323 andMOD(A2,1)retrieves 0.75. Format the first result as a date and the second as a time to read the two parts. - 6ExampleConvert a duration into hours
A duration of 7:45 is stored as 7.75/24 of a day. Multiplying that stored value by 24 gives 7.75 decimal hours. Multiplying it by 1440 gives 465 minutes.
The 45 minutes become 0.75 of an hour because 45/60 is 0.75. Entering 7.45 as decimal hours would mean 7 hours 27 minutes, so the colon and decimal point describe different quantities.
- 7TipKeep long durations out of TIME
TIME(25,0,0)returns 1:00 AM because TIME describes a clock within one day. It discards the complete 24-hour cycle.For a 25-hour duration, store
=25/24and apply[h]:mm. HOUR also reads only the clock-hour part of a long duration. Multiply the stored value by 24 when the task asks for total hours, including complete days. - 8ChallengeChoose a unit and display
A2 is a time value showing 3:45. You need a numeric number of hours for a calculation. What formula and format should you use?
---reveal---
Use
=A2*24and a Number or General format. The result is 3.75 hours. A time format would interpret 3.75 as days and display a clock remainder; dividing by 24 would convert in the opposite direction. - 9ExplanationChoose a live date or a record
TODAY returns the current date; NOW includes the current time. Both update when the sheet recalculates, and NOW does not continuously tick.
Use these functions for a changing view of current deadlines. A received-date record needs a fixed date value so that old rows stay on their original day. A live formula would replace that history with the new current date.
- 10ExampleKeep the whole due day open
C2 contains a plain due date.
=IF(TODAY()>C2,"Overdue","Open")leaves the task open on that date and marks it overdue the next day.A plain date is midnight at the beginning of its day. NOW becomes larger during the due day, so
NOW()>C2is too early for this rule. Use NOW when the deadline itself includes an exact time. - 11ChallengePreserve a report date
A team wants a report to show the same statuses next week as when it was saved today. What should its shared report-date cell contain?
---reveal---
Store today's date as a fixed value and use that cell in the status formulas. Leaving TODAY in the cell would update the reference day on recalculation and change the report. A fixed date preserves the chosen reporting day.
- 12ChallengeRead a misleading day count
A fixed report date in F1 and due date in C2 produce
=C2-$F$1. The result appears as "1/18/1900". What is the likely repair, and what does the result mean?---reveal---
Apply a Number or General format to the result: it is 18 calendar days remaining. The date display is interpreting the small numeric difference as a date serial. The fixed report date itself is appropriate for a report that must stay reproducible.
- 13RecapCheck value, unit, and purpose
When a result looks wrong, inspect what it stores before changing its formula. A date serial identifies a day; a time fraction measures part of a day; a difference measures elapsed days.
Choose the format for that quantity, convert days to hours when needed, and decide whether the reference date should update or stay fixed. These checks distinguish a display problem from an incorrect calculation.
2Build dates and label their weeks
14 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionDescribe the same date in several ways
- 2ExplanationExtract numeric parts
- 3ExampleBuild the first of the month
- 4Key InsightOverflow changes the target month
- 5ChallengeMake a quarter label
- 6ExplanationPick a weekday numbering
- 7ExampleTurn a timestamp into its Monday
- 8ChallengeRepair the weekend flag
- 9ExplanationA week start is only half the rule
- 10ExampleFollow the week across January 1
- 11ExampleFind the ISO year from Thursday
- 12ChallengeDistinguish Monday-first from ISO
- 13ChallengeCheck the year boundary together
- 14RecapKeep the rule with the label
3Move through months and anniversaries
13 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionRead the calendar rule first
- 2ExampleMove January 31 into February
- 3ExampleKeep the original renewal day
- 4ChallengeChoose the third renewal
- 5ExplanationAsk directly for a month end
- 6ExampleTranslate the invoice wording
- 7ChallengeFind the quarter end
- 8ExplanationCount only completed years
- 9ExampleSeparate total and leftover months
- 10TipCalculate remaining days from an anniversary
- 11ChallengeUse a fixed age cutoff
- 12ChallengeCombine months and an eligibility test
- 13RecapLet the wording choose the function
4Count and schedule with a working calendar
13 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionGive the calendar to the formula
- 2ExampleCount four working weeks
- 3TipKeep the holiday list stable
- 4ChallengeExclude a nonworking today
- 5ExampleCount after the receipt date
- 6Key InsightA count and a deadline use different endpoints
- 7ExampleAdjust a calendar target forward
- 8ChallengeWork backward from a report deadline
- 9ExplanationReplace the weekend pattern
- 10ExampleSchedule with Friday–Saturday off
- 11ChallengeRead the pattern as text
- 12ChallengeCombine the pattern and holiday list
- 13RecapCheck the count in a short interval
5Turn a time sheet into paid hours
13 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionFollow the units through a time sheet
- 2ExampleSubtract a shift and its break
- 3ExplanationCarry a night shift across midnight
- 4ChallengeChoose a method for a long interval
- 5ExampleShow a weekly total without wrapping
- 6ExampleConvert the total before applying a rate
- 7ExplanationSplit regular and overtime hours
- 8ExampleCalculate each pay component
- 9ChallengeKeep short-week overtime at zero
- 10TipApply the specified rounding stage
- 11ChallengeFinish a rounded weekly calculation
- 12Key InsightA money format does not round the value
- 13RecapKeep duration, hours, and pay distinct
6Build a monthly report from timestamps
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionGive each record a clear period
- 2ExampleMake a real month key
- 3ExampleMake an equal key for every weekly record
- 4ChallengeKeep weekly and monthly reports separate
- 5ExplanationUse a start and a next start
- 6ExampleAssemble the monthly SUMIFS
- 7ExampleCheck the selected records
- 8ChallengeProtect the last evening
- 9TipCopy periods while keeping the source fixed
- 10ChallengeChoose the right average
- 11ChallengeBuild a report that copies correctly
- 12RecapTest boundaries before trusting totals
Date and Time Functions practice questions
Set 1: Build dates and choose calendar rules10 Practice Questions
Question 1 of 10
WEEKDAY(A2,2) return when A2 is a Sunday?Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
=EOMONTH(A2,1) return?Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
=DATE(2027,2,30) return a date in March?Show answerHide answer
Question 7 of 10
Show answerHide answer
Question 8 of 10
Show answerHide answer
Question 9 of 10
Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Read stored values and current dates10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
=TODAY() on every row. What happens to old rows when the sheet recalculates on a later day?Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
=DATE(YEAR(A2),MONTH(A2),1) return?Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
=NOW()>C2. Why?Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 3: Count workdays and schedule deadlines10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
NETWORKDAYS(TODAY(),deadline)-1?Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 4: Calculate durations and pay10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 5: Build reliable period reports10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
A2-WEEKDAY(A2,2)+1. Why can they form separate groups?Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
Age threshold
EDATE(B2,12*18)<=C2 checks whether the 18th anniversary has arrived by the date in C2.Anniversary
B
Backward scheduling
Break deduction
C
Calendar-day deadline
Chronological sort
Clock component
Complete date-time interval
Completed year
COUNTIFS
Custom weekend
D
DATE
=DATE(2027,4,6) identifies April 6 without relying on how the region reads a typed date string.Date criterion
">="&E2 reads E2's date value; the quoted text ">=E2" leaves the cell name inside text.Date rollover
DATE(2026,2,31) becomes March 3, which explains why rebuilding the next month can overshoot February.Date system
Date-time
DATEDIF
DAY
DAY(EOMONTH(A2,0)) uses the last date's day number to find how many days A2's month contains.Decimal hours
Duration
E
EDATE
Elapsed-hour format
[h]:mm displays accumulated hours without hiding full 24-hour periods from a long duration.EOMONTH
Exclusive upper boundary
F
Fiscal year
Fixed timestamp
H
Helper column
Holiday list
Hourly rate
I
Inclusive endpoint
ISO week
ISO week year
ISOWEEKNUM
L
Leftover months
M
MOD
Money rounding
MONTH
Month boundary
Month key
Month offset
Month-to-date total
N
NETWORKDAYS
NETWORKDAYS.INTL
NOW
NOW(), but a plain due date needs a whole-day comparison.Number format
O
On-or-after adjustment
WORKDAY(A2-1,1,Holidays) lets the target date count as the next workday when it is already eligible.Overnight shift
Overtime hours
MAX(0,43.75-40) gives 3.75 overtime hours.Overtime multiplier
P
Payment term
Period key
Q
Quarter end
Quarter-hour rounding
R
Reference date
Regular hours
Report date
Return type
WEEKDAY(A2,2)>5.S
Schedule anchor
$A$2 and use each row's month offset to keep a January 31 schedule aligned.Serial number
SUMIFS
T
TEXT
TEXT(A2,"yyyy-mm") makes a sortable month label such as "2026-10"; retain a date key for arithmetic.Text date
ISNUMBER(A2) helps check whether the cell holds a numeric value.TIME
=TIME(27,0,0) produces 3:00 AM, so a 27-hour duration needs a stored value of 27/24 instead.Time value
TODAY
TODAY() gives calendar days remaining, and the result should be formatted as a number.V
Volatile function
W
Week start
WEEKDAY
Weekend code
Weekend string
WEEKNUM
WORKDAY
WORKDAY.INTL
Working-day average
Working-day count
Y
YEAR
Z
Zero padding
- 1Logical Functions
- 2Conditional Counting and Summing
- 3Lookup Functions
- 4Text Functions
- 5Date and Time Functions
- 6Dynamic Arrays
- 7Troubleshooting Formulas
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.