The Excel Date function converts a supplied year, month and day into an Excel date.
The syntax of the function is:
where the year, month and day arguments are integers representing the year, month and day of the required date.
Column D of the following spreadsheet shows the Date function applied to different sets of values.
Formulas:
|
Results:
|
Typically, when using the Date function, the supplied year will be between 1900 and 9999, the month will be between 1 and 12 and the day will be between 1 and 31. However, these values can extend outside these ranges, in which case, they behave as follows:
year | - |
If the supplied year argument is between 0 and 1899, this value is added onto 1900. For example: |
||||||||||||||||||||||||
|
||||||||||||||||||||||||||
month | - |
If the supplied month argument is negative or is greater than 12, the date extends back or forward, into the previous or following year. For example: |
||||||||||||||||||||||||
|
||||||||||||||||||||||||||
day | - |
If the supplied day argument is negative or is greater than 31, the date extends back or forward, into the previous or following month. For example: |
||||||||||||||||||||||||
|
For further information and examples of the Excel Date function, see the Microsoft Office website.
If you get an error from the Excel Date Function, this is likely to be one of the following:
#NUM! | - | Occurs if the supplied year argument is < 0 or ≥ 10000. |
#VALUE! | - | Occurs if any of the supplied arguments are non-numeric. |
Also, some users of the Excel Date function encounter the following problem:
The result of your Date function looks like a number (e.g. "41061"), instead of a date.
This is likely to be due to the formatting of the cell. I.e. the function has actually returned the correct value, but the cell is displaying the date serial number, instead of the formatted date.
You therefore need to change the formatting of the cell to display a date. The easiest way to do this is to select the cell(s) to be formatted and then select the Date cell formatting option from the drop-down menu in the 'Number' group on the Home tab of the Excel ribbon (see below):
See the Excel Formatting page for more details on formatting in Excel.