Protected Learning Content

AICPE Gurukul content is created for learning purposes. Printing, copying and unauthorized reuse are restricted.

AICPE Learning Hub Advanced Excel
Chapter 08
Date and Time Functions
Chapter 08 | Advanced Formulas and Functions

Date and Time Functions

Turn dates and times into reliable business intelligence. This chapter teaches you to calculate age, experience, due dates, month-end schedules, working days, attendance hours and deadlines while avoiding the common errors caused by text-formatted dates.

Date Intelligence Chapter · Eight Practical Activities Included
Learning Objectives

After This Chapter, You Will Be Able To

Use Excel dates and times confidently in HR, sales, accounts, operations, attendance and project-management workbooks.

Create Valid Dates

Build reliable dates with DATE and repair records stored in inconsistent formats.

Calculate Durations

Measure age, experience, service periods and elapsed time with appropriate formulas.

Plan Deadlines

Move by months, find month-end dates and calculate working-day deadlines.

Build Time Reports

Analyze attendance hours, delays, shift duration and time-based performance.

Date Function Roadmap

Select the Function According to the Business Question

First identify whether you must create a date, extract a component, measure a period or calculate a deadline.

CreateDATE, TIME, DATEVALUE and TIMEVALUE
ExtractDAY, MONTH, YEAR, HOUR, MINUTE and SECOND
MeasureDATEDIF, subtraction and YEARFRAC
ScheduleEDATE, EOMONTH, WORKDAY and NETWORKDAYS

1 Understanding How Excel Stores Dates and Times

Excel normally stores a date as a serial number and displays that number using a date format. Time is stored as a fraction of one day. This design allows Excel to add days, subtract dates, compare deadlines and calculate working durations. A value that only looks like a date but is stored as text will not behave reliably in formulas, sorting or PivotTables.

Definition: A valid Excel date is a numeric serial value displayed through a date format; a valid time is a fractional part of a day.
Displayed ValueUnderlying MeaningPossible UseImportant Check
15-Aug-2026Date serial numberDeadline, joining date, invoice dateShould align right by default when stored as a number
09:30 AMFraction of one dayIn-time, meeting time, shift startUse a time format rather than typing descriptive text
15/08/2026 stored as textCharacter stringImported or manually entered recordMay fail in subtraction and chronological sorting
2.5 daysNumeric durationTurnaround timeChoose a display format that communicates the unit clearly

Dates, Display Formats and Regional Settings

The same date can be displayed as 15-Aug-2026, 15/08/2026 or August 15, 2026 without changing the stored value. Problems arise when users enter ambiguous text such as 04/05/2026 because different systems may interpret the month and day differently. For shared workbooks, use clear formats such as dd-mmm-yyyy and validate imported data before analysis.

Professional Tip: Store dates as genuine Excel values and control appearance through formatting. Do not type extra words directly into cells that must be used in calculations.

Practical Experiment 1: Identify Real Dates

Enter or paste a mixture of valid dates, text dates and blank cells into a worksheet.

Step 1: Observe

Compare alignment, number format and formula-bar values for each record.

Step 2: Test

Use =ISNUMBER(A2) to identify whether the value is stored numerically.

Step 3: Record

Mark each row as valid date, text date, invalid entry or blank.

Learning Output: You will distinguish a genuine date value from text that only looks like a date.

2 TODAY, NOW and DATE

TODAY returns the current date, while NOW returns the current date and time. Both are volatile functions, meaning they recalculate when the workbook recalculates. DATE constructs a valid date from separate year, month and day values, making it safer than joining date parts as text.

=TODAY()

Returns the current system date and supports ageing, overdue and days-remaining calculations.

=NOW()

Returns the current date and time for live status, elapsed-hour and timestamp-style calculations.

=DATE(A2,B2,C2)

Builds a valid date using year in A2, month in B2 and day in C2.

=B2-TODAY()

Returns the number of days remaining until the due date stored in B2.

Business RequirementFormulaResult TypeUse
Show today’s date=TODAY()DateDaily reports and automatic headings
Show live date and time=NOW()Date-timeElapsed-time monitoring
Create date from three columns=DATE(A2,B2,C2)DateImported year, month and day fields
Mark overdue status=IF(B2<TODAY(),"Overdue","Open")Text statusInvoice and task tracking
Caution: TODAY and NOW update automatically. Do not use them when a permanent historical timestamp is required unless you intentionally convert the result to a fixed value.

Practical Experiment 2: Live Deadline Tracker

Create task names and due dates, then calculate current status automatically.

Step 1: Create

Enter five tasks with past, current and future due dates.

Step 2: Calculate

Use due date minus TODAY to calculate days remaining.

Step 3: Classify

Use IF to return Overdue, Due Today or Open.

Learning Output: You will build a date-driven status report that changes automatically.

3 DAY, MONTH, YEAR and Calendar Components

DAY, MONTH and YEAR extract numeric components from a valid date. These functions help create monthly summaries, yearly comparisons, financial-year classifications and age-analysis fields. WEEKDAY and WEEKNUM support calendar-based reporting and scheduling.

=DAY(A2)

Returns the day number from a valid date.

=MONTH(A2)

Returns a month number from 1 to 12 for grouping and logic.

=YEAR(A2)

Returns the four-digit year for annual analysis.

=TEXT(A2,"mmm-yyyy")

Creates a readable reporting label such as Aug-2026 while returning text.

Creating Reporting Periods

A monthly sales report may require a month label, quarter, calendar year and financial-year category. Extracting components allows these fields to be created consistently. Remember that a TEXT result is excellent for labels but should not replace a genuine date when later date calculations are required.

DAYDay number
MONTHMonth number
YEARCalendar year
WEEKDAYDay-of-week index
WEEKNUMWeek number

Practical Experiment 3: Build Reporting Columns

Use a transaction-date column to create analysis-ready date dimensions.

Step 1: Extract

Create day, month and year columns using date functions.

Step 2: Label

Create month-year and weekday labels using TEXT.

Step 3: Analyze

Summarize the number of transactions by month and weekday.

Learning Output: You will prepare date dimensions for PivotTables and dashboards.

4 Calculating Age, Experience and Duration

Subtracting one date from another returns the number of elapsed days. DATEDIF can return completed years, months or days between two dates, while YEARFRAC estimates the interval as a fraction of a year. Choose the method according to the business definition, not merely according to the shortest formula.

=TODAY()-A2

Returns total elapsed days from the date in A2 to today.

=DATEDIF(A2,TODAY(),"Y")

Returns completed years, suitable for age or completed service.

=DATEDIF(A2,B2,"M")

Returns completed months between two dates.

=YEARFRAC(A2,B2)

Returns the interval as a fraction of a year for proportional calculations.

RequirementRecommended ApproachExampleImportant Note
Total turnaround daysEnd date minus start date=B2-A2Format the result as General or Number
Completed ageDATEDIF with "Y"=DATEDIF(A2,TODAY(),"Y")Start date must not be later than end date
Completed monthsDATEDIF with "M"=DATEDIF(A2,B2,"M")Returns complete months only
Proportion of a yearYEARFRAC=YEARFRAC(A2,B2)Basis selection can affect financial calculations
Business Rule: Define whether the start day, end day, weekends or partial periods must be included. Two formulas can be technically correct yet answer different operational questions.

Practical Experiment 4: Employee Service Analysis

Create employee names, joining dates and service metrics.

Step 1: Calculate

Return completed service years with DATEDIF.

Step 2: Detail

Calculate remaining months after completed years if required.

Step 3: Classify

Group employees into service bands such as Below 1 Year, 1–3 Years and 3+ Years.

Learning Output: You will create an HR service-tenure report using dynamic date logic.

5 EDATE and EOMONTH for Month-Based Planning

EDATE moves a date forward or backward by a specified number of months. EOMONTH returns the last date of a month after moving by a specified number of months. These functions are valuable for renewal schedules, instalment dates, subscription periods, reporting cut-offs and month-end accounting.

=EDATE(A2,3)

Returns the date three months after the date in A2.

=EDATE(A2,-1)

Returns the corresponding date one month earlier.

=EOMONTH(A2,0)

Returns the final date of the same month.

=EOMONTH(A2,0)+1

Returns the first date of the next month.

1Start Date

Identify the transaction, joining, invoice or contract date.

2Month Offset

Decide how many months to move forward or backward.

3Boundary Rule

Choose same-day logic with EDATE or month-end logic with EOMONTH.

4Status Check

Compare the calculated date with TODAY to mark upcoming or overdue items.

Practical Experiment 5: Renewal Schedule

Create customer names, activation dates and subscription periods in months.

Step 1: Calculate

Use EDATE to return the renewal date.

Step 2: Compare

Calculate days remaining using renewal date minus TODAY.

Step 3: Alert

Create a Renewal Due Soon status for items due within 30 days.

Learning Output: You will build an automatic month-based renewal tracker.

6 NETWORKDAYS and WORKDAY

NETWORKDAYS counts working days between two dates, normally excluding Saturdays and Sundays. WORKDAY returns a future or past working date after adding a specified number of workdays. Both functions can use a holiday range. Their INTL versions allow custom weekend patterns.

=NETWORKDAYS(A2,B2)

Counts working days from start date to end date using the standard weekend.

=NETWORKDAYS(A2,B2,$H$2:$H$12)

Also excludes holidays listed in H2:H12.

=WORKDAY(A2,10)

Returns the date ten working days after A2.

=WORKDAY.INTL(A2,10,7,$H$2:$H$12)

Uses a custom weekend code and a holiday list.

FunctionReturnsTypical UseKey Input
NETWORKDAYSCount of working daysAttendance, service-level days, project durationStart date, end date, optional holidays
WORKDAYA working dateDelivery date, due date, follow-up dateStart date, number of workdays, optional holidays
NETWORKDAYS.INTLWorking-day countNon-standard weekly offsWeekend code or pattern
WORKDAY.INTLA working dateCustom-shift deadline planningWeekend code or pattern
Remember: NETWORKDAYS normally includes both start and end dates when they are working days. Confirm the required business policy before interpreting the result.

Practical Experiment 6: Service-Level Deadline

Calculate a promised completion date after a fixed number of working days.

Step 1: Prepare

Create request dates and a separate holiday list.

Step 2: Schedule

Use WORKDAY to calculate the committed completion date.

Step 3: Measure

Use NETWORKDAYS to calculate actual working days used.

Learning Output: You will calculate practical deadlines that exclude non-working days.

7 Time Functions and Attendance Calculations

HOUR, MINUTE and SECOND extract parts of a time value. TIME constructs a valid time from separate components. Subtracting an in-time from an out-time returns a fraction of a day; multiplying by 24 converts that duration into decimal hours. For shifts crossing midnight, MOD can prevent a negative result.

=TIME(A2,B2,C2)

Creates a valid time from hour, minute and second values.

=HOUR(A2)

Returns the hour component from a valid time or date-time.

=(C2-B2)*24

Returns decimal hours between out-time and in-time for a same-day shift.

=MOD(C2-B2,1)

Returns a positive duration for a shift that may cross midnight; format as [h]:mm.

Time Formats for Durations

The format h:mm displays a time of day and may reset after 24 hours. The format [h]:mm displays accumulated hours beyond 24, making it more appropriate for weekly attendance totals. Decimal hours are useful for productivity and payroll calculations, while [h]:mm is often easier to read.

Practical Experiment 7: Attendance Hours

Create employee in-time, out-time and break duration fields.

Step 1: Calculate

Subtract in-time and break time from out-time.

Step 2: Format

Display duration as [h]:mm and also calculate decimal hours.

Step 3: Flag

Mark records below the required working-hour threshold.

Learning Output: You will create a reliable daily attendance-duration report.

8 Converting Text Dates and Times

Imported dates and times may arrive as text. DATEVALUE converts a recognized text date into a date serial number, while TIMEVALUE converts recognized text time into a time value. Text to Columns, Power Query and controlled formulas may be safer for large or inconsistent datasets.

=DATEVALUE(A2)

Converts a recognizable text date into a valid Excel serial number.

=TIMEVALUE(A2)

Converts recognizable text time into a valid time value.

=DATE(RIGHT(A2,4),MID(A2,4,2),LEFT(A2,2))

Builds a date from fixed-position dd/mm/yyyy text.

=TEXT(B2,"dd-mmm-yyyy")

Creates a formatted text label; the result is text, not a date value.

Data Quality Rule: Preserve the original imported column, create a cleaned date column and test a sample of records before replacing or reporting from the transformed data.

Practical Experiment 8: Repair Imported Dates

Use a sample containing dd/mm/yyyy text, month names, blank cells and invalid entries.

Step 1: Diagnose

Use ISNUMBER and visual checks to identify text dates.

Step 2: Convert

Apply DATEVALUE or a component-based DATE formula according to the pattern.

Step 3: Validate

Compare converted dates with the source and flag invalid values for review.

Learning Output: You will convert imported date text without losing auditability.
Real-Time Practical Assignment

Build an Employee Attendance and Leave Deadline Tracker

Combine date creation, duration, working-day and time calculations in one professional workbook.

Project Brief

Create a workbook with Employee ID, Employee Name, Joining Date, Date, In-Time, Out-Time, Break, Leave Request Date, Approval Days and Holiday List.

Step 1: Structure

Create an Excel Table with validated date and time columns.

Step 2: Calculate

Calculate service years, daily working hours, leave approval deadline and days remaining.

Step 3: Review

Add status fields for short hours, overdue approvals and upcoming employee anniversaries.

Required Output: A clean workbook containing formulas, consistent formats, holiday-aware deadlines, exception flags and a short management summary.

Assignment Checklist

1
Valid Date FieldsUse real Excel dates, not manually typed descriptive text.
2
Service CalculationReturn completed service years using joining date and TODAY.
3
Attendance DurationCalculate net hours after subtracting breaks.
4
Working-Day DeadlineUse WORKDAY with an absolute holiday-list reference.
5
Status LogicIdentify overdue, due-soon and completed records.

Review Questions

A
Why use [h]:mm?Explain how it differs from h:mm for accumulated duration.
B
Which dates are text?Describe how you tested imported records.
C
Which weekend applies?Confirm whether standard or custom weekend logic is required.
D
What updates automatically?Identify calculations affected by TODAY or NOW.
E
What needs audit?List invalid, blank or ambiguous date records requiring review.
Date Formula Selection Lab

Choose a Task and Generate a Suggested Formula

Select the business requirement and enter the relevant cell references.

Common Mistakes

Mistakes Students Should Avoid

Date errors can remain hidden until a report is sorted, filtered, summarized or compared with a deadline.

Wrong Habits

  • Typing dates in ambiguous formats without checking regional interpretation.
  • Assuming every date-looking value is stored as a valid Excel date.
  • Formatting a text value as Date and believing it has been converted.
  • Using TODAY when a fixed historical date is required.
  • Ignoring holidays and custom weekly offs in deadline calculations.
  • Using h:mm for totals that can exceed 24 hours.
  • Subtracting times across midnight without handling the day change.
  • Replacing imported source data before validating the conversion.

Correct Habits

  • Use clear formats such as dd-mmm-yyyy in shared workbooks.
  • Test date validity with ISNUMBER and sample calculations.
  • Convert text using DATEVALUE, DATE or controlled data-cleaning tools.
  • Use a fixed value when a permanent timestamp is necessary.
  • Maintain an approved holiday list and use absolute references.
  • Use [h]:mm for accumulated hours and decimal hours for analysis.
  • Apply MOD for time differences that may cross midnight.
  • Keep original imported columns for comparison and recovery.
Remember: A date format changes only appearance. Reliable analysis requires a valid underlying date or time value.
AICPE Quality Learning Commitment

AICPE Gurukul is designed to provide practical, skill-based and career-oriented learning content for students, institutes and professionals. Learn more at aicpeindia.org and aicpe.online.

Knowledge Check

Quick Quiz: Date and Time Functions

Answer all 12 questions, submit the quiz and review the explanations.

1. How does Excel normally store a valid date?

A valid Excel date is normally a numeric serial value displayed through a date format.

2. Which function returns the current date without the current time?

TODAY returns the current date, while NOW returns both date and time.

3. Which formula creates a date from year in A2, month in B2 and day in C2?

DATE constructs a valid date from separate year, month and day numbers.

4. Which formula returns completed years between A2 and today?

DATEDIF with unit Y returns the number of completed years.

5. What does =EOMONTH(A2,0) return?

EOMONTH with zero offset returns the final date of the same month.

6. Which function returns a date after adding a specified number of working days?

WORKDAY returns a working date after moving by the specified number of workdays.

7. What does NETWORKDAYS return?

NETWORKDAYS counts working days between two dates and can also exclude a holiday list.

8. Which format is best for displaying accumulated hours beyond 24?

Square brackets prevent the hour display from resetting after 24 hours.

9. Why is MOD useful when calculating a night shift?

MOD(out-time minus in-time,1) handles the rollover into the next day.

10. Which function converts recognizable text such as 15-Aug-2026 into a date serial?

DATEVALUE converts a recognized text date into a numeric date serial.

11. What is the main risk of using TODAY in a historical report?

TODAY is dynamic and updates when the workbook recalculates, so it is not a permanent timestamp.

12. Why should the original imported date column be preserved?

Keeping source data allows transformed results to be verified and corrected if a conversion rule fails.
Quick Revision

Remember These Date and Time Principles

Review these points before moving to modern dynamic-array formulas.

Real Date Values

Excel calculations require genuine numeric date and time values, not text that only looks correct.

Current Date

TODAY returns the current date; NOW returns the current date and time, and both update automatically.

Date Components

DAY, MONTH and YEAR support calendar analysis, while TEXT creates readable labels.

Duration

Use subtraction for total days, DATEDIF for completed units and YEARFRAC for proportional years.

Month Planning

EDATE moves by months and EOMONTH finds month boundaries for renewals and reports.

Workdays and Time

WORKDAY and NETWORKDAYS handle business calendars; [h]:mm supports accumulated duration.