Description
The Microsoft Excel DATE function returns the serial date value for a date. Please note that the DATE function (VBA) has a different syntax and functionality.
TIP: If your cell is formatted as General and you enter the DATE function, Excel will format your result as
mm/d/yyyy
(column E) based on your Regional Settings. If you wish to see the serial number result (column D) from the DATE function, you will have to change the format of the cell to General after entering the formula.If you want to follow along with this tutorial, download the example spreadsheet.
Syntax
The syntax for the DATE function in Microsoft Excel is:
DATE( year, month, day )
Parameters or Arguments
- year
- A number that is between one and four digits that represents the year.
- month
- A number representing the month value. If the month value is greater than 12, then every 12 months will add 1 year to the year value. This means that DATE(2016,13,4) is equal to DATE(2017,1,4) and DATE(2016,25,4) is equal to DATE(2018,1,4) ... and so on.
- day
- A number representing the day value. If the day value is greater than the number of days in the month specified, then the appropriate number of months will be added to the month value.
Note
- If the year is between 0 and 1899, the year value is added to 1900 to determine the year.
- If the year is between 1900 and 9999, the DATE function uses the year value as the year.
- If the year is greater than 9999, the DATE function will return the #NUM! error.
- A serial date is how Excel stores dates internally and it represents the number of days since January 1, 1900.
Applies To
- Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
- Worksheet function (WS)
Example (as Worksheet Function)
Let's look at some Excel DATE function examples and explore how to use the DATE function as a worksheet function in Microsoft Excel:
Because the DATE function returns a serial date, we wanted to show you the result from the DATE function as an unformatted serial date which you can see this in column D.
We also wanted to show you the result as a formatted date which is how a user would format the results. In column E, we have formatted the result from the DATE function as
mm/d/yyyy
.Based on the Excel spreadsheet above, the following DATE examples would return:
=DATE(A3,B3,C3)
Result: 42613 'Which can be formatted as "8/31/2016"
=DATE(A4,B4,C4)
Result: 42551 'Which can be formatted as "6/30/2016"
=DATE(A5,B5,C5)
Result: 42373 'Which can be formatted as "1/4/2016"
=DATE(A6,B6,C6)
Result: 42739 'Which can be formatted as "1/4/2017"
Notice in the last example
=DATE(B6,B6,C6)
that the month value is 13 and larger than 12. In this example, 1 would be added to the year making it 2017. And the remainder of 1 would used as the month value.
No comments:
Post a Comment