DEV Community

Cover image for Using Excel Date Function: Excel24x7
Vigneshwaran Vijayakumar for Excel 24x7

Posted on • Originally published at excel24x7.com

Using Excel Date Function: Excel24x7

Excel Date Function

Date Function: A Brief

The Excel DATE function helps create a valid date using separate values for the year, month, and day. This function is useful when you need dates that update automatically based on other values in your worksheet.

Objective Value Returned by function
Aim to display or create date with Year, Month & Day Date Function will return a valid Excel date in multiple forms.

Date Function: A Syntax

=DATE(year,month,day)
Enter fullscreen mode Exit fullscreen mode
  1. Year– Years mentioned in as Numbers.
  2. Month– Months mentioned in as Numbers.
  3. Day– Days mentioned in as Numbers.

Using Date Function with Practical Examples:

The DATE function in Excel creates a date using separate numbers for the year, month, and day. It returns a serial number that represents a valid date in Excel. To see the output as a proper date, apply a date format.

Using the DATE function is the most reliable way to create dates in Excel formulas. Unlike text-based dates, which can be misinterpreted, this function ensures that the year, month, and day values are clear and accurate.

Example 1: Hand Typed Dates as Numbers:

This is the basic and most common method to use the date function to display the proper excel date in the target cell based in the user provided numeric inputs. Refer to the below examples:

=DATE(1992,12,22)  //Displays- 22 December 1992
=DATE(2012,4,14)   //Displays- 14 April 2012
=DATE(2018,5,19)   //Displays- 19 May 2018

Choose the target cell, type the above syntax and hit Enter button to display results.
Enter fullscreen mode Exit fullscreen mode

Date Function Example displaying dates from hand typed numeric input data

Date Function Example displaying dates from hand typed numeric input data

Example 2: Using Cell Reference to Execute Date Function:

The DATE function is helpful for creating dates that update automatically based on other values in a worksheet. For example, if 2023 is entered in cell D1, the formula below will return the date July 20, 2023:

Note: If D1 is later changed to 2025 and the DATE function will update the result to show July 20, 2025.

=DATE(D16,7,20)  //Displays- 20 July 2023

Here- D16 represents the value located in the cell D16.
Enter fullscreen mode Exit fullscreen mode

Date Function example using cell reference

Date Function example using cell reference

In Date Functions, output year value changes with cell reference value in real time

In Date Functions, output year value changes with cell reference value in real time

Example 3: Using Date Function to display the First Day of the Present Year:

You can simply use the date function to display the first day of the present or current year and the formula to do this is,

=DATE(YEAR(TODAY()),1,1) // Displays- Present Year's 1st day date
Enter fullscreen mode Exit fullscreen mode

The simple formula display the first day of the present year using date function.

The simple formula display the first day of the present year using date function.

Here to achieve this, I have used two more functions and they are: Year and Today functions.

  • Year Function– Displays the year section in the date with 4 digits.
  • Today Function– Display the today’s date or current day date in the cell.

This is an live example of nesting multiple functions in Excel. The TODAY function gets the current date and passes it to the YEAR function. The YEAR function extracts the year and sends it to the DATE function as the year value. The month and day are set to 1, so the result is the first day of the current year, such as “January 1, 2025”.

Example 4: Combining with multiple complex functions such as Date Functions with SUMIFS, COUNTIFS:

You have a dataset containing sales records, where: Column A contains sales dates, Column B contains sales amounts, Column C contains salesperson names. If you want to find the following: Count the number of sales transactions after a specific date (e.g., January 1, 2023), Sum the total sales after that same date, Apply both conditions dynamically based on the year, month, and day values stored in separate cells.

Formula to Count Sales After February 1, 2024:

=COUNTIF(A16:A21, ">" & DATE(2024,2,1))
Enter fullscreen mode Exit fullscreen mode

Formula to Sum Sales After February 1, 2024:

=SUMIFS(B16:B21, A16:A21, ">" & DATE(2024,2,1))
Enter fullscreen mode Exit fullscreen mode

Practical Example of using Date function with COUNTIF and SUM function in excel.

Practical Example of using Date function with COUNTIF and SUM function in excel.

Verifying Answers from the above example manually: Count Explanation, Dates after February 1, 2024:

  • 10-Feb-24
  • 15-Mar-24
  • 20-Mar-24
  • 25-Apr-24

Total count = 4, Which is correct one.

The SUMIFS result from the above formula (2600) is also correct because the sum of sales after Feb 1, 2024 is:

  • 700 (Feb 10)
  • 900 (Mar 15)
  • 400 (Mar 20)
  • 600 (Apr 25)

Adding all the value to get 2600 which is absolutely correct. Hence the above formula is proved correctly. In this way, you can use the Date function to make work with other complex functions to solve day to day needs.

Interesting Tips about Date Function:

  • The DATE function only accepts numeric values. If you enter text, it will return a #VALUE! error.
  • The DATE function returns a serial number that represents a valid date in Excel.
  • Excel dates start from the year 1990. If you enter a year between 0 and 1990, Excel will add 1990 to it.

That’s it.

Vigneshwaran Vijayakumar.

Feel free to comment us below, if you have any queries about the above topic and find more interesting excel tutorials on our homepage.

References:

Top comments (0)