Unleashing Excel’s Date Functions for Seamless Data Management

Enhance your data management skills and embrace new levels of productivity with Excel’s date functions.

Rashidat Sikiru
DATA4FASHION
7 min readJul 18, 2023

--

excel date functions
Source: The Spreadsheet Page

Have you ever found yourself faced with a spreadsheet brimming with dates, leaving you uncertain about how to navigate through it?

Yes, I have been there, and I know how it feels. Not to worry, I got you covered!

We will unravel the mysteries that shroud dates, helping you to conquer any date-related challenge that comes your way. Get ready for an in-depth exploration as we delve into two expansive outline chapters, each containing a range of captivating sub-topics.

Let’s go!

Understanding How Excel Handles Dates

  1. Understanding date serial numbers

Have you ever encountered a string of numbers that seemed unrelated to dates, as shown below?

Source: Author Figure 1

Well, there’s a fascinating reason behind it. In Excel, dates are actually interpreted as numbers. Each date is assigned a serial number, representing the count of days since the imaginary date of January 0, 1900. For instance, a serial number of 1 corresponds to January 1, 1900, and the count continues consecutively. This unique system enables us to conveniently use formulas for date-related calculations.

For example, we can easily determine the number of days between them by subtracting one date from another. This ingenious approach simplifies working with dates in Excel and opens up a world of possibilities.

To view a date serial number as a date, you must format the cell as a date.

Choose Home ➪Number ➪ Number Format. This drop-down control provides you with two date formats.

Date Formatting

2. Entering Dates in Excel:

When it comes to entering dates in Excel, you’ve got a couple of options. If you happen to know the specific serial number of the date, you can enter it directly and then format it as a date. But more often than not, you’ll probably enter a date using one of the recognised date formats.

Source: quickmemes

Here’s the cool part: Excel works its magic behind the scenes as soon as you enter a date using one of those formats. It automatically converts your entry into the corresponding date serial number, which it uses for all its calculations.

Let’s say you want to enter June 18, 2018, into a cell. You can simply type “June 18, 2018” using any of the accepted date formats. Excel will instantly understand what you mean and store the value 43269, which is the date serial number for that specific date.

Congratulations on conquering the first outline! 👏👏. Get ready for an interesting adventure in the next outline.

Using Excel Date Functions

Excel has quite a few functions that work with dates. These functions are accessible by choosing:

Formulas ➪ Function Library ➪ Date & Time.

Navigating the date function

These functions work on the fact that underneath the covers, dates are nothing more than a numbering system. This allows for all kinds of cool formula-driven analyses. Now, let’s pick them one after the other.

1. Getting the Current Date and Time

Imagine you’re working on a project that involves tracking tasks and deadlines for a team. You have a spreadsheet where you need to keep track of various details, including the start date and time for each task. In such a situation, the TODAY and NOW functions can be beneficial for real-time tracking and automated calculations.

The TODAY function returns the current date, while the now function returns the current date alongside the time.

Syntax:

TODAY()

NOW()

Fun Fact: These functions will automatically recalculate each time you change or open your workbook.

2. Calculating Time Duration in Excel

If you want to calculate a person's age or are tasked with calculating the years remaining until each client reaches their retirement age, the DATEDIF function in Excel can be a lifesaver. By inputting a person’s birthdate and current date, you can swiftly determine their age in years, months, or even days.

Syntax

DATEDIF(start_date,end_date,unit)

DATEDIF(“5/16/1972”,TODAY(),”y”)

Click here to find what the DATEDIF unit returns.

Fun Fact: The DATEDIF function is not included in the Excel function, it has to be completely typed.

3. Extracting parts of a date

It’s often helpful to pick out a specific part of a date. For example, you may need to filter all records that have order dates within a certain month or all employees who have time allocated to Saturdays. In these situations, you would need to pull out the month and workday numbers from the formatted dates. The following functions are used to extract part of a date:

a. YEAR extracts the year from a given date. This is represented as

=YEAR(date)

b. MONTH extracts the month from a given date. This is represented as

=MONTH(date)

c. DAY extracts the day number from a given date. This is represented as

=DAY(date)

d. WEEKDAY returns the weekday number for a given date. This is represented as

=WEEKDAY(date)

e. WEEKNUM returns the week number for a given date. This is represented as

=WEEKNUM(date)

4. Calculating the number of workdays between two dates

Assuming you work in a project management role, you’re responsible for tracking project timelines and calculating the number of working days required for completion. You need to determine the number of business days between two specified dates, accounting for weekends and possibly considering custom non-working days based on specific regions or project requirements. In this case, the NETWORKDAYS and NETWORKDAYS.INTL functions can be extremely valuable.

Syntax

NETWORKDAYS(start_date, end_date, [holidays])

NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays])

click here to see how you can represent weekends with numbers

Fun fact: NETWORKDAYS.INTL works in situations where the weekends are not actually Fridays and Saturdays, or when the weekends only include Sundays.

5. Generating a list of business days excluding holidays

You are in a situation where you need to calculate the expected delivery dates for orders, accounting for business days and considering specific non-working days based on different countries’ holidays and weekends. In this case, the WORKDAY.INTL function can be highly beneficial.

Syntax

WORKDAY.INTL(start_date, days, [weekend], [holidays])

6. Converting dates to Julian date formats

Julian dates are often used in manufacturing environments as a timestamp and quick reference for batch numbers. This type of date coding allows retailers, consumers, and service agents to identify when a product was made and thus the age of the product. It is widely used in various fields, including astronomy, scientific research, and data analysis.

Excel has no built-in function to convert a standard date to a Julian date, but below is how a formula can be used to accomplish the task.

=RIGHT(YEAR(start_date),2)& start_date -DATE(YEAR(start_date),1,0)

The first formula uses the RIGHT function to extract the right two digits of the year number. Note that we are using the YEAR function to pull out the year portion from the actual date.

The second formula is a bit trickier. Here we have to find out how many days have elapsed since the beginning of the year. For this, we first need to subtract the target date from the last day of the previous year.

7. Calculating the percentage of the year completed and remaining

One crucial aspect of your life as an analyst is calculating the percentage of the year that has elapsed and what percentage remains. These percentages can be used in other calculations or simply as a notification for your audience. To achieve this, you can use the YEARFRAC function in Excel.

Syntax

To get the percentage completed

YEARFRAC(start_date, end_date, [basis])

To get the percentage remaining,

1- YEARFRAC(start_date, end_date, [basis])

8. Returning the last date of a given month

A common need when working with dates is to dynamically calculate the last date in a given month. Although the last day for most months is fixed, the last day for February varies depending on whether the given year is a leap year. We can use the formula below to achieve this:

Syntax

=DATE(YEAR(B3),MONTH(B3)+1,0)

Alternatively, The EOMONTH function is easier than using the DATE function. With the EOMONTH function, you can get the last date of any future or past month.

Syntax

EOMONTH(start_date, months)

The month's parameter can be positive, which returns the date of the month in the future; negative, which returns the last date of the month in the past; or zero, which returns the last date of the current month.

9. Calculating the calendar quarter for a date

Guess what! There is no built-in function to calculate quarter numbers in Excel.

If you need to calculate in which calendar quarter a specific date falls, you’ll need to create your own formula.

Syntax

ROUNDUP(MONTH(date)/3, num_digits)

10. Returning a fiscal month from a date

In some organisations, the operationally recognised months don’t start on the 1st and end on the 30th or 31st. Instead, they have specific days marking the beginning and end of a month. For instance, you may work in an organisation where each fiscal month starts on the 21st and ends on the 20th of the next month. In these organisations, it’s important to be able to translate a standard date into their own fiscal months. You can do this by

Syntax

TEXT(EOMONTH(start_date–20,1),”mmm”)

CONCLUSION
Congratulations on reaching the end of our Excel journey! If you have any questions, feedback, or a special request, don’t hesitate to drop them in the comment session or reach out to me on LinkedIn.

Stay tuned for our next chapter, where we’ll dive deeper into advanced techniques and unveil more hidden gems. Thank you for joining me on this thrilling journey, and may your Excel endeavours be filled with triumph and joy!

Check out more data-related articles on the DATA4FASHION Blog.

--

--

Rashidat Sikiru
DATA4FASHION

A Research Data Scientist with experience in various machine learning tools