DATE function

Use Excel's DATE function when you need to take three separate values and combine them to form a date.

The syntax to use is: DATE(year,month,day). For example: =DATE(C2,A2,B2) combines the year from cell C2, the month from cell A2, and the day from cell B2 and puts them into one cell as a date. The picture below shows the final result in cell D2.

A2 contains 9, B2 contains 22, C2 contains 2015, D2 contains =DATE(C2,A2,B2), result is 9/22/2015

Need to insert dates without a formula? No problem. You can insert the current date, or you can insert a date that gets updated. You can also fill a column of dates automatically.

Change the date format

  1. Right-click the cell(s) you want to change. On a Mac, Ctrl-click the cells.

  2. Click Format Cells.

  3. Change the location menu to your preferred one. For example, choose the option for United Kingdom.

  4. Above the location menu is where you can specify the date format. Choose the format you want. For example, on a PC, choose 14/03/2012 to change to the DD/MM/YYYY format. On a Mac, choose 14/03/2015 to change to the DD/MM/YYYY format

For more information on formatting dates, see Format a date the way you want.

Convert dates into sequential serial numbers

Behind the scenes, Excel stores dates as sequential serial numbers so that they can be used in calculations. For example, January 1, 1900 is serial number 1. And January 1, 2008 is 39448 because it is 39,448 days after January 1, 1900. If you want convert a date into a serial number, first format the cell as Number:

  1. Right-click the cell(s) you want to change. On a Mac, Ctrl-click the cells.

  2. Click Format Cells.

  3. Click Number and then change the Decimal places to 0.

  4. Then type a formula using the DATE function.

In the example below, D2 is formatted as a number with 0 decimal places. It also has the formula =DATE(C2,A2,B2) and therefore returns the value 42269 which is a serial number.

A2 contains 9, B2 contains 22, C2 contains 2015, D2 contains =DATE(C2,A2,B2), result is 42269

Convert text strings and numbers into dates

If you open a file that came from another program, Excel will try to recognize dates within the data. But sometimes the dates aren't recognizable. This is may be because the numbers don't resemble a typical date, or because the data is formatted as text. If this is the case, you can use the DATE function to convert the information into dates. For example, in the following illustration, cell C2 contains a date that is in the format: YYYYMMDD. It is also formatted as text. To convert it into a date, the DATE function was used in conjunction with the LEFT, MID, and RIGHT functions.

C2 contains 20161001 formatted as text, D2 contains =DATE(LEFT(C2,4),MID(C2,5,2),RIGHT(C2,2)), result is 10/1/2016

  1. The DATE function creates a date.

  2. The year of the date is created by using the LEFT function. The LEFT function looks at cell C2 and takes the first 4 characters from the left. This establishes “2016” as the year of the converted date in cell D2.

  3. The month of the date is created by using the MID function. The MID function looks at cell C2. It starts at the 5th character, and then takes 2 characters to the right. This establishes “10” as the month of the converted date in cell D2.

  4. The day is created by using the RIGHT function. The RIGHT function looks at cell C2 and takes the first 2 characters starting from the very right and moving left. This establishes “01” as the day of the date in D2. Because the formatting of D2 set to Date, the “0” isn’t included in the final result.

Calculate a date based on another date

You can use the DATE function to create a date that is based on another cell’s date. For example, you can use the YEAR, MONTH, and DAY functions to create an anniversary date that’s based on another cell. In this example, Christopher’s first day at work is 10/1/2016. But the DATE function can be used to establish his fifth year anniversary date:

C2 contains 10/1/2016, D2 contains =DATE(YEAR(C2)+5,MONTH(C2),DAY(C2)). the result is 10/1/2021

  1. The DATE function creates a date.

  2. The year of the date is created by using the YEAR function. The YEAR function looks at cell C2 and extracts "2016".

  3. Then, "+5" adds 5 years, and establishes "2021" as the anniversary year in cell D2.

  4. The month of the date is created by using the MONTH function. The MONTH function extracts the "10" from C2. This establishes "10" as the month in cell D2.

  5. The day of the date is created by using the DAY function. The DAY function extracts "1" from C2. This establishes "1" as the day in cell D2.

Technical details

The DATE function returns the sequential serial number that represents a particular date.

Syntax: DATE(year,month,day)

The DATE function syntax has the following arguments:

  • Year    Required. The value of the year argument can include one to four digits. Excel interprets the year argument according to the date system your computer is using. By default, Microsoft Excel for Windows uses the 1900 date system.

    We recommend using four digits for the year argument to prevent unwanted results. For example, "07" could mean "1907" or "2007." Four digit years prevent confusion.

    • If year is between 0 (zero) and 1899 (inclusive), Excel adds that value to 1900 to calculate the year. For example, DATE(108,1,2) returns January 2, 2008 (1900+108).

    • If year is between 1900 and 9999 (inclusive), Excel uses that value as the year. For example, DATE(2008,1,2) returns January 2, 2008.

    • If year is less than 0 or is 10000 or greater, Excel returns the #NUM! error value.

  • Month    Required. A positive or negative integer representing the month of the year from 1 to 12 (January to December).

    • If month is greater than 12, month adds that number of months to the first month in the year specified. For example, DATE(2008,14,2) returns the serial number representing February 2, 2009.

    • If month is less than 1, month subtracts the magnitude of that number of months, plus 1, from the first month in the year specified. For example, DATE(2008,-3,2) returns the serial number representing September 2, 2007.

  • Day    Required. A positive or negative integer representing the day of the month from 1 to 31.

    • If day is greater than the number of days in the month specified, day adds that number of days to the first day in the month. For example, DATE(2008,1,35) returns the serial number representing February 4, 2008.

    • If day is less than 1, day subtracts the magnitude that number of days, plus one, from the first day of the month specified. For example, DATE(2008,1,-15) returns the serial number representing December 16, 2007.

Note: Excel stores dates as sequential serial numbers so that they can be used in calculations. January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900.

See Also

Add or subtract dates

Insert the current date and time in a cell

Fill dates automatically

YEAR function

MONTH function

DAY function

TODAY function

DATEVALUE function

Date and time functions (reference)

All Excel functions (by category)

All Excel functions (alphabetical)

Was this information helpful?

How can we improve it?

How can we improve it?

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!