Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

Excel Date and Time

Excel provides a variety of functions to work with dates and times. This article explores some of the most commonly used date functions, along with practical use cases for each.

DATE

The DATE function creates a date from individual year, month, and day components. This is useful when you have separate year, month, and day values and need to combine them into a single date.

Formula

=DATE(2023, 6, 10)

Use Case

Suppose you have year, month, and day values in separate cells and want to combine them into one date. This is particularly useful when data is imported from different sources and needs to be consolidated.

Example Data

YearMonthDayDate
2023610=DATE(A2, B2, C2)

DATEDIF

The DATEDIF function calculates the difference between two dates. This function is useful for determining the number of days, months, or years between two dates.

Formula

=DATEDIF(A1, B1, "d")

Use Case

You might want to calculate the duration of a project or the number of days until a deadline. The DATEDIF function helps in such scenarios by providing the difference between start and end dates.

Example Data

Start DateEnd DateDays Difference
2023-01-012023-06-10=DATEDIF(A2, B2, "d")

NETWORKDAYS

The NETWORKDAYS function returns the number of whole workdays between two dates, excluding weekends and optionally specified holidays.

Formula

=NETWORKDAYS(A1, B1)

Use Case

This function is particularly useful in business and project management contexts where you need to calculate the number of working days available for a task or project, excluding weekends and holidays.

Example Data

Start DateEnd DateWorkdays Difference
2023-01-012023-06-10=NETWORKDAYS(A2, B2)

EDATE

The EDATE function returns the date that is the indicated number of months before or after the start date.

Formula

=EDATE(A1, 6)

Use Case

This function is useful when you need to calculate due dates or expiration dates that are a specific number of months from a given date.

Example Data

Start DateMonths to AddNew Date
2023-01-016=EDATE(A2, B2)

Summary Table

Below is a summary table with all the example data for easy reference:

YearMonthDayStart DateEnd DateMonths to AddDateDays DifferenceWorkdays DifferenceNew Date
20236102023-01-012023-06-106=DATE(A2, B2, C2)=DATEDIF(D2, E2, "d")=NETWORKDAYS(D2, E2)=EDATE(D2, G2)