ZetCode

Excel DATE Function

last modified April 4, 2025

The DATE function is a fundamental date function in Excel that creates valid dates from individual year, month, and day components. This tutorial provides a comprehensive guide to using the DATE function. You'll learn basic syntax, practical applications, and advanced techniques to master this essential Excel function for date manipulation and calculations.

DATE Function Basics

The DATE function constructs a date value from year, month, and day components. It handles date arithmetic automatically and corrects invalid dates. The syntax is straightforward but powerful for date manipulation.

Component Description
Function Name DATE
Syntax =DATE(year, month, day)
Arguments year, month, day (all required)
Return Value Excel date serial number

This table breaks down the essential components of the DATE function. It shows the function name, basic syntax format, required arguments, and return value characteristics. The function returns an Excel serial date.

Basic DATE Example

This example demonstrates the simplest use of the DATE function with hard-coded year, month, and day values.

Basic DATE formula
=DATE(2023, 5, 15)

This formula creates a date for May 15, 2023. Excel will display this as 5/15/2023 (format depending on regional settings). The function returns the Excel date serial number 45061.

DATE with Cell References

A more practical use of DATE involves referencing cells for year, month, and day components. Here's an example with cell references.

A B C D
2023 12 25
=DATE(A1, B1, C1)

The table shows a simple spreadsheet with year, month, and day values in cells A1, B1, and C1. The DATE formula in D1 creates a date from these components.

DATE with cell references
=DATE(A1, B1, C1)

This formula creates December 25, 2023 from the values in cells A1 (2023), B1 (12), and C1 (25). The result appears as a formatted date (12/25/2023).

DATE with Automatic Month Correction

DATE automatically handles month values greater than 12 by incrementing the year. This example shows this behavior.

A B C D
2023 15 1
=DATE(A1, B1, C1)

This table demonstrates DATE's ability to correct invalid month values. The month value 15 is automatically converted to March of the following year.

DATE with month overflow
=DATE(2023, 15, 1)

This formula creates March 1, 2024 from year 2023 and month 15. DATE automatically adds the extra months to the year. The day remains unchanged.

DATE with Day Overflow

DATE similarly handles day values that exceed the number of days in the month. This example demonstrates this correction.

A B C D
2023 2 30
=DATE(A1, B1, C1)

The table shows how DATE handles day values exceeding the month's days. February 2023 has 28 days, so day 30 rolls over to March.

DATE with day overflow
=DATE(2023, 2, 30)

This formula creates March 2, 2023 from February 30, 2023. DATE adds the extra 2 days to February 28, rolling into March. The month increments as needed.

DATE with Negative Values

DATE can handle negative month and day values, counting backward from the specified date. This example shows this behavior.

A B C D
2023 5 -5
=DATE(A1, B1, C1)

This table demonstrates DATE's handling of negative day values. A negative day counts backward from the first day of the next month.

DATE with negative day
=DATE(2023, 5, -5)

This formula creates April 25, 2023 (May 1 minus 5 days plus 1). Negative days are calculated from the first day of the next month. Similar logic applies to negative months.

DATE in Date Calculations

DATE is often used in date arithmetic to add or subtract days, months, or years from a date. This example shows adding months to a date.

A B C
1/15/2023 6
=DATE(YEAR(A1), MONTH(A1)+B1, DAY(A1))

The table shows how to use DATE with other date functions to perform date arithmetic. This formula adds 6 months to the date in A1.

DATE for adding months
=DATE(YEAR(A1), MONTH(A1)+6, DAY(A1))

This formula takes the date in A1 (January 15, 2023) and adds 6 months, resulting in July 15, 2023. DATE automatically handles month overflow if needed.

DATE with Dynamic Arrays

In modern Excel, DATE can work with dynamic arrays to generate date sequences. This example creates a series of dates.

DATE with SEQUENCE
=DATE(2023, 1, SEQUENCE(31))

This formula generates all dates in January 2023 (1/1/2023 through 1/31/2023). The SEQUENCE function provides the day numbers, and DATE converts them to valid dates. This creates a dynamic array of dates.

DATE with Other Functions

DATE is often combined with other functions like TODAY to create relative dates. This example shows creating a date 90 days from today.

DATE with TODAY
=DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY())+90)

This formula calculates the date 90 days from today. It extracts year, month, and day from TODAY(), adds 90 to the day, and DATE handles any overflow automatically. The result is a future date.

DATE for Last Day of Month

A common technique uses DATE to find the last day of a month by specifying day 0 of the next month.

Last day of month with DATE
=DATE(2023, 3, 0)

This formula returns February 28, 2023 (or 29 in leap years). Day 0 of March means the last day of February. This technique works for any month to find its last day.

The DATE function is essential for all Excel date calculations. From basic date creation to complex date arithmetic, DATE handles it all reliably. Mastering its various applications will significantly improve your date manipulation skills. Remember that DATE automatically corrects invalid dates and works seamlessly with other date functions.

Author

My name is Jan Bodnar, and I am a passionate programmer with extensive programming experience. I have been writing programming articles since 2007. To date, I have authored over 1,400 articles and 8 e-books. I possess more than ten years of experience in teaching programming.

List all Excel Formulas.