Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Data Analysis with Excel Functions ยท Lesson 7 of 9

Module Six

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
7

Module 6: Date and Time Functions in Excel

Module Introduction

Imagine you are managing student records in a school in Ibadan. You have a spreadsheet showing students' registration dates, examination dates, payment dates, and graduation dates.

You may want to know how many days are left before an examination, which month a student registered, or how many days a customer took to pay for a product.

Microsoft Excel provides date and time functions that help you calculate, organise, and analyse information involving dates and time.

Learning Objectives

By the end of this module, you should be able to:

  • Understand how Excel stores dates and times.
  • Use the TODAY and NOW functions.
  • Use DAY, MONTH, and YEAR to extract date information.
  • Use DATE to create dates.
  • Calculate the number of days between two dates.
  • Use time functions to analyse working hours.
  • Apply date and time functions to real-life data.

1. Understanding Dates and Times in Excel

Excel can recognise dates and times as values that you can calculate with.

For example, you can subtract one date from another to find the number of days between them. You can also calculate how many hours an employee has worked.

Examples of dates and times include:

  • 27/11/2026
  • 15/06/2026
  • 8:30 AM
  • 4:45 PM

Important: Excel must recognise a value as a date or time before date and time calculations will work correctly. Text that only looks like a date may not calculate properly.

2. Using the TODAY Function

The TODAY function displays the current date according to your computer's date settings.

TODAY Function Syntax

=TODAY()

The function does not need any information inside its brackets.

Example

Enter this formula in cell A2:

=TODAY()

Excel displays the current date. For example, if the current date is 27 November 2026, the result will show that date.

The date updates automatically when Excel recalculates the worksheet on a later day.

Uses of TODAY include:

  • Checking the current date.
  • Calculating how many days remain before an examination.
  • Tracking payment deadlines.
  • Monitoring employee registration dates.

3. Using the NOW Function

The NOW function displays the current date and time.

NOW Function Syntax

=NOW()

Enter the formula in any empty cell. Excel will display the current date and time.

For example, the result may look like this: 27/11/2026 10:30 AM.

The exact result depends on your computer's clock and date settings. Like TODAY, NOW updates when Excel recalculates.

4. Using DAY, MONTH, and YEAR Functions

Sometimes you have a complete date but only need a particular part of it. Excel provides three functions that can extract the day, month, or year.

The DAY Function

DAY extracts the day number from a date.

Syntax:

=DAY(serial_number)

Suppose cell A2 contains the date 27/11/2026. Enter:

=DAY(A2)

Result: 27

The MONTH Function

MONTH extracts the month number from a date.

Syntax:

=MONTH(serial_number)

Using the same date, enter:

=MONTH(A2)

Result: 11

November is the eleventh month of the year.

The YEAR Function

YEAR extracts the year from a date.

Syntax:

=YEAR(serial_number)

Enter:

=YEAR(A2)

Result: 2026

5. Using the DATE Function

The DATE function creates a valid Excel date using a year, month, and day.

DATE Function Syntax

=DATE(year, month, day)

Example

Enter:

=DATE(2026,11,27)

Result: 27 November 2026, depending on the cell's date format.

You can use this function when building reports, preparing schedules, and creating dates from separate year, month, and day columns.

6. Calculating the Number of Days Between Dates

Excel allows you to subtract one date from another to calculate the number of days between them.

Example: Tracking Examination Dates

Imagine a school in Lagos plans to hold an examination on 15 December 2026. The current date is stored in cell A2, while the examination date is stored in B2.

Enter this formula in C2:

=B2-A2

Excel calculates the number of days between the two dates, provided both cells contain valid dates.

Using TODAY to Calculate Days Remaining

You can also use TODAY to calculate the number of days remaining before an event.

=B2-TODAY()

If the examination date is in the future, the result shows the number of days remaining. If the date has already passed, the result will be negative.

7. Using the DATEDIF Function

DATEDIF calculates the difference between two dates in years, months, or days.

It is useful for calculating a person's age, length of employment, or how long a customer has been registered.

DATEDIF Syntax

=DATEDIF(start_date, end_date, unit)

The unit tells Excel what type of difference to calculate:

  • "Y": Complete years between two dates.
  • "M": Complete months between two dates.
  • "D": Total days between two dates.

Example: Calculating a Student's Age

Assume a student's date of birth is stored in cell A2. To calculate the student's age in complete years, enter:

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

Excel calculates the number of complete years between the student's date of birth and today's date.

Note: DATEDIF is supported in Excel, although it may not appear in the formula autocomplete suggestions.

8. Understanding Time Functions

Excel can also work with time. This is useful when calculating employee working hours, delivery times, and business operating periods.

The HOUR Function

HOUR extracts the hour from a time value.

=HOUR(A2)

If A2 contains 3:45 PM, the result is 15 when Excel uses its 24-hour time value.

The MINUTE Function

MINUTE extracts the minute from a time value.

=MINUTE(A2)

If A2 contains 3:45 PM, the result is 45.

The SECOND Function

SECOND extracts the seconds from a time value.

=SECOND(A2)

If A2 contains 3:45:30 PM, the result is 30.

9. Using the TIME Function

The TIME function creates a time value using hours, minutes, and seconds.

TIME Function Syntax

=TIME(hour, minute, second)

Example

Enter:

=TIME(14,30,0)

Result: 2:30 PM, if the cell is formatted using a 12-hour time format.

This function can help create time schedules and organise business operating hours.

10. Practical Example: Employee Attendance Records

Imagine a company in Lagos wants to calculate how long employees spend at work each day.

Employee Time In Time Out Hours Worked
Ade8:00 AM4:00 PM8
Mary9:00 AM5:00 PM8
John8:30 AM3:30 PM7

If the time employees arrive is stored in column B and the time they leave is stored in column C, enter this formula in D2:

=(C2-B2)*24

Excel stores time as part of a 24-hour day. Multiplying the difference by 24 converts it into hours.

Format the result as a Number to display the number of hours worked.

11. Common Date and Time Mistakes to Avoid

  • Entering dates as text instead of valid Excel dates.
  • Using the wrong date format for your spreadsheet.
  • Forgetting that TODAY and NOW update when Excel recalculates.
  • Subtracting dates in the wrong order and getting a negative result.
  • Forgetting to multiply time differences by 24 when calculating hours.
  • Using the wrong cell reference in a date or time formula.
  • Confusing DAY, MONTH, and YEAR.

12. Practical Exercise

A computer training centre in Ibadan wants to organise its student registration and class attendance records.

Student Registration Date Class Start Time Class End Time
David05/01/20269:00 AM11:00 AM
Mary15/03/202610:00 AM12:30 PM
John20/06/20268:30 AM10:30 AM
Grace10/09/20261:00 PM3:00 PM

Your Tasks

  1. Use TODAY to display the current date.
  2. Use NOW to display the current date and time.
  3. Use DAY to extract the day from each registration date.
  4. Use MONTH to extract the month number.
  5. Use YEAR to extract the registration year.
  6. Use DATE to create a date using a year, month, and day.
  7. Calculate the number of days between two registration dates.
  8. Use DATEDIF to calculate the complete months between two dates.
  9. Calculate how many hours each student spends in class.

Module Summary

In this module, you learned how to use Excel date and time functions to organise and analyse time-based information.

  • TODAY: Displays the current date.
  • NOW: Displays the current date and time.
  • DAY: Extracts the day from a date.
  • MONTH: Extracts the month from a date.
  • YEAR: Extracts the year from a date.
  • DATE: Creates a date from year, month, and day values.
  • DATEDIF: Calculates the difference between two dates.
  • HOUR, MINUTE, and SECOND: Extract parts of a time value.
  • TIME: Creates a time value.

These functions are useful for school records, employee attendance, business reports, customer registrations, and project schedules.

What Is Next?

In Module 7, you will learn about Lookup and Reference Functions in Excel. You will discover how to find information in large datasets using functions such as VLOOKUP, HLOOKUP, and XLOOKUP.

๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’