DATE Function in Excel

Part 1: Introduction to the DATE Function in Microsoft Excel

Definition

The DATE function in Excel is a built-in function that allows you to create a date with individual year, month, and day components. It’s beneficial when constructing a date from three separate values.

Purpose

The primary purpose of the DATE function is to return the sequential serial number that represents a specific date. This serial number is based on Excel’s date system, where January 1, 1900, is serial number 1.

Syntax & Arguments

The syntax for the DATE function is as follows:

syntax
DATE(year, month, day)

The DATE function has three arguments:

  1. Year: This is a required argument. The value of the year argument can include one to four digits. Excel interprets the year argument according to your computer’s date system. By default, Microsoft Excel for Windows uses the 1900 date system, which means the first date is January 1, 1900.

  2. Month: This is also a required argument. It is a positive or negative integer representing the month of the year from 1 to 12 (January to December).

  3. Day: This is a required argument as well. It is a positive or negative integer representing the day of the month from 1 to 31.

Return Value

The DATE function returns a serial number that represents a specific date. This serial number can be used in calculations, and you will need to change the number format (Format Cells) to display a proper date.

Remarks

Excel stores date as sequential serial numbers to be used in calculations. January 1, 1900, is serial number 1; for example, January 1, 2008, is serial number 39448 because it is 39,447 days after January 1, 1900.

Part 2: Examples of the DATE Function in Microsoft Excel

Example 1: Calculating Invoice Due Dates

Purpose of Example

This example demonstrates how to use the DATE function to calculate invoice due dates in a business setting.

Data Tables and Formulas

ABC
1Invoice DateTerms (Days)Due Date
22023-01-0130=DATE(YEAR(A2), MONTH(A2), DAY(A2) + B2)
32023-02-1545=DATE(YEAR(A3), MONTH(A3), DAY(A3) + B3)
42023-03-2060=DATE(YEAR(A4), MONTH(A4), DAY(A4) + B4)

Explanation

In this example, we have invoice dates in column A and terms (in days) in column B. The due date is calculated by adding the words to the invoice date using the DATE function. The formula in cell C2 adds 30 days to the invoice date in cell A2. The same procedure is used in cells C3 and C4 to calculate the due dates for the other invoices.

Example 2: Projected Sales Date

Purpose of Example

This example demonstrates how to use the DATE function to project future sales dates based on current sales and growth rates.

Data Tables and Formulas

ABC
1Last Sales DateGrowth Period (Months)Projected Sales Date
22023-01-013=DATE(YEAR(A2), MONTH(A2) + B2, DAY(A2))
32023-02-156=DATE(YEAR(A3), MONTH(A3) + B3, DAY(A3))
42023-03-209=DATE(YEAR(A4), MONTH(A4) + B4, DAY(A4))

Explanation

In this example, column A’s last sales dates and column B’s growth period (in months). The projected sales date is calculated by adding the growth period to the previous sales date using the DATE function. The formula in cell C2 adds three months to the last sales date in cell A2. The same procedure is used in cells C3 and C4 to calculate the projected sales dates for the other periods.

Example 3: Calculating Expiry Dates

Purpose of Example

This example demonstrates how to use the DATE function to calculate the expiry dates of products in a business setting.

Data Tables and Formulas

ABC
1Manufacture DateShelf Life (Years)Expiry Date
22023-01-012=DATE(YEAR(A2) + B2, MONTH(A2), DAY(A2))
32023-02-153=DATE(YEAR(A3) + B3, MONTH(A3), DAY(A3))
42023-03-205=DATE(YEAR(A4) + B4, MONTH(A4), DAY(A4))

Explanation

In this example, we have the manufacture dates in column A and the shelf life (in years) in column B. The expiry date is calculated by adding the shelf life to the manufacture date using the DATE function. The formula in cell C2 adds two years to the manufacture date in cell A2. The same procedure is used in cells C3 and C4 to calculate the expiry dates for the other products.

Example 4: Calculating End of Financial Year Dates

Purpose of Example

This example demonstrates how to use the DATE function to calculate the end-of-financial year dates in a business setting.

Data Tables and Formulas

AB
1Financial Year StartFinancial Year End
22023-01-01=DATE(YEAR(A2) + 1, 12, 31)
32024-01-01=DATE(YEAR(A3) + 1, 12, 31)
42025-01-01=DATE(YEAR(A4) + 1, 12, 31)

Explanation

In this example, column A shows the start dates of financial years. The end of the financial year is calculated using the DATE function to add one year to the start date and set the month and day to December 31. The formula in cell B2 puts the end of the financial year to December 31 of the following year. The same procedure is used in cells B3 and B4 to calculate the end of the financial year for the other start dates.

Example 5: Calculating Project Completion Dates

Purpose of Example

This example demonstrates how to use the DATE function to calculate project completion dates based on the start date and the project duration.

Data Tables and Formulas

ABC
1Project Start DateProject Duration (Months)Project Completion Date
22023-01-016=DATE(YEAR(A2), MONTH(A2) + B2, DAY(A2))
32023-02-159=DATE(YEAR(A3), MONTH(A3) + B3, DAY(A3))
42023-03-2012=DATE(YEAR(A4), MONTH(A4) + B4, DAY(A4))

Explanation

In this example, we have the project start dates in column A and the project duration (in months) in column B. The project completion date is calculated by adding the project duration to the start date using the DATE function. The formula in cell C2 adds six months to the project start date in cell A2. The same procedure is used in cells C3 and C4 to calculate the project completion dates for the other projects.


Example 6: Calculating Employee’s Anniversary Date

Purpose of Example

This example demonstrates how to use the DATE function nested with the IF function to calculate an employee’s anniversary date based on their start date and current date.

Data Tables and Formulas

ABC
1Start DateCurrent DateAnniversary Date
22020-01-012023-01-01=IF(MONTH(B2)>=MONTH(A2), DATE(YEAR(B2), MONTH(A2), DAY(A2)), DATE(YEAR(B2)-1, MONTH(A2), DAY(A2)))
32020-02-152023-01-15=IF(MONTH(B3)>=MONTH(A3), DATE(YEAR(B3), MONTH(A3), DAY(A3)), DATE(YEAR(B3)-1, MONTH(A3), DAY(A3)))
42020-03-202023-02-20=IF(MONTH(B4)>=MONTH(A4), DATE(YEAR(B4), MONTH(A4), DAY(A4)), DATE(YEAR(B4)-1, MONTH(A4), DAY(A4)))

Explanation

In this example, we have the employee’s start dates in column A and the current date in column B. The anniversary date is calculated by comparing the current month with the start month using the IF function and then using the DATE function to return the anniversary date. If the current month is greater than or equal to the start month, the anniversary date is in the current year. Otherwise, the anniversary date is in the previous year.

Example 7: Calculating Total Sales for a Specific Month

Purpose of Example

This example demonstrates how to use the DATE function nested with the SUM, and IF functions to calculate total sales for a specific month.

Data Tables and Formulas

ABC
1DateSalesTotal Sales for January 2023
22023-01-011000=SUM(IF(MONTH(A2:A4)=1, IF(YEAR(A2:A4)=2023, B2:B4, 0), 0))
32023-02-152000=SUM(IF(MONTH(A2:A4)=1, IF(YEAR(A2:A4)=2023, B2:B4, 0), 0))
42023-03-203000=SUM(IF(MONTH(A2:A4)=1, IF(YEAR(A2:A4)=2023, B2:B4, 0), 0))

Explanation

In this example, we have the sales dates in column A and the sales amounts in column B. The total sales for January 2023 are calculated using the SUM and IF functions to sum the sales amounts where the month and year match January 2023.

Example 8: Finding Employee Information Based on Hire Date

Purpose of Example

This example demonstrates how to use the DATE function nested with the VLOOKUP function to find employee information based on their hire date.

Data Tables and Formulas

ABC
1Hire DateEmployee NameEmployee Hired on 2023-01-01
22023-01-01John Doe=VLOOKUP(DATE(2023, 1, 1), A2:B4, 2, FALSE)
32023-02-15Jane Doe=VLOOKUP(DATE(2023, 1, 1), A2:B4, 2, FALSE)
42023-03-20Bob Smith=VLOOKUP(DATE(2023, 1, 1), A2:B4, 2, FALSE)

Explanation

In this example, we have the hire dates in column A and the employee names in column B. The employee hired on 2023-01-01 is found using the VLOOKUP function with the DATE function to look up the hire date in the table and return the corresponding employee name.

Example 9: Calculating the End of the Quarter

Purpose of Example

This example demonstrates how to use the DATE function nested with the CEILING function to calculate the end of the quarter for a given date.

Data Tables and Formulas

AB
1DateEnd of Quarter
22023-01-01=DATE(YEAR(A2), CEILING(MONTH(A2), 3), 0)
32023-02-15=DATE(YEAR(A3), CEILING(MONTH(A3), 3), 0)
42023-03-20=DATE(YEAR(A4), CEILING(MONTH(A4), 3), 0)

Explanation

In this example, we have the dates in column A. The end of the quarter is calculated using the CEILING function with the DATE function to round the month up to the nearest multiple of 3 and then using the DATE function to return the last day of that month.

Example 10: Calculating the Start of the Next Month

Purpose of Example

This example demonstrates how to use the DATE function nested with the EOMONTH function to calculate the start of the following month for a given date.

Data Tables and Formulas

AB
1DateStart of Next Month
22023-01-01=DATE(YEAR(A2), MONTH(A2) + 1, 1)
32023-02-15=DATE(YEAR(A3), MONTH(A3) + 1, 1)
42023-03-20=DATE(YEAR(A4), MONTH(A4) + 1, 1)

Explanation

In this example, we have the dates in column A. The start of the following month is calculated using the DATE function to add 1 to the month and set the day to 1.

Example 11: Calculating Age

Purpose of Example

This example demonstrates how to use the DATE function nested with the TODAY, and YEARFRAC functions to calculate a person’s age based on their birth date.

Data Tables and Formulas

AB
1Birth DateAge
21980-01-01=INT(YEARFRAC(A2, TODAY()))
31990-02-15=INT(YEARFRAC(A3, TODAY()))

 

Explanation

In this example, we have the birth dates in column A. The age is calculated using the YEARFRAC function to calculate the fraction of a year between the birth date and today’s date and then using the INT function to round down to the nearest whole number.

Example 12: Calculating the Number of Days until Next Christmas

Purpose of Example

This example demonstrates how to use the DATE function nested with the TODAY and YEAR functions to calculate the number of days until the following Christmas.

Data Tables and Formulas

AB
1DateDays until Next Christmas
22023-01-01=IF(A2>DATE(YEAR(A2), 12, 25), DATE(YEAR(A2)+1, 12, 25)-A2, DATE(YEAR(A2), 12, 25)-A2)
32023-02-15=IF(A3>DATE(YEAR(A3), 12, 25), DATE(YEAR(A3)+1, 12, 25)-A3, DATE(YEAR(A3), 12, 25)-A3)
42023-03-20=IF(A4>DATE(YEAR(A4), 12, 25), DATE(YEAR(A4)+1, 12, 25)-A4, DATE(YEAR(A4), 12, 25)-A4)

Explanation

In this example, we have the dates in column A. The number of days until the next Christmas is calculated using the DATE function to create the date of the following Christmas and then subtract the current date. If the date is after Christmas, the DATE function makes the date of the following year’s Christmas.

Example 13: Calculating the End of the Fiscal Year

Purpose of Example

This example demonstrates how to use the DATE function nested with the IF function to calculate the end of the fiscal year for a given date, assuming the fiscal year ends on June 30.

Data Tables and Formulas

AB
1DateEnd of Fiscal Year
22023-01-01=IF(MONTH(A2)<=6, DATE(YEAR(A2), 6, 30), DATE(YEAR(A2)+1, 6, 30))
32023-07-15=IF(MONTH(A3)<=6, DATE(YEAR(A3), 6, 30), DATE(YEAR(A3)+1, 6, 30))
42023-03-20=IF(MONTH(A4)<=6, DATE(YEAR(A4), 6, 30), DATE(YEAR(A4)+1, 6, 30))

Explanation

In this example, we have the dates in column A. The end of the fiscal year is calculated by using the DATE function to create the date of the end of the fiscal year and then using the IF function to check if the current date is in the first or second half of the fiscal year. If the current date is in the first half of the fiscal year, the end of the fiscal year is June 30 of the current year. If the current date is in the second half of the fiscal year, the end of the fiscal year is June 30 of the following year.


Part 3: Tips and Tricks

  1. Use Four-Digit Years: Always use four digits for the year argument in the DATE function to prevent confusion between different centuries. For example, “07” could mean “1907” or “2007”. Four-digit years avoid this confusion.

  2. Handling Out-of-Range Arguments: If the month argument is greater than 12, Excel adds that number of months to the first month in the year specified. Similarly, if the day argument is greater than the number of days in the month specified, Excel adds that number of days to the first day in the month.

  3. Opposing Arguments: If the month or day argument is less than 1, Excel subtracts the magnitude of that number, plus 1, from the first month or day in the year specified.

  4. Error Values: If the year argument is less than 0 or is 10000 or more excellent, Excel returns the #NUM! Error value.

  5. Date Formatting: Remember that Excel stores date as sequential serial numbers. To display the result of the DATE function as a proper date, you may need to change the number format (Format Cells).

  6. Combining with Other Functions: The DATE function can be combined with other tasks like YEAR, MONTH, and DAY to create more complex date calculations. For example, you can use these functions to create an anniversary date based on another cell’s date.

Leave a Comment