Convert dates stored as text to dates

Occasionally, dates may become formatted and stored in cells as text. For example, you may have entered a date in a cell that was formatted as text, or the data might have been imported or pasted from an external data source as text.

Dates that are formatted as text are left-aligned instead of right-aligned in a cell. With Error Checking turned on, text dates with two-digit years might also be marked with an error indicator Cell with a formula problem.

Because Error Checking in Microsoft Excel can identify text-formatted dates with two-digit years, you can use the automatic correction options to convert them to date-formatted dates. You can use the DATEVALUE function to convert most other types of text dates to dates.

What do you want to do?

Convert text dates with two-digit years by using Error Checking

Convert text dates by using the DATEVALUE function

Convert text dates with two-digit years by using Error Checking

  1. On the Tools menu, click Options.
  2. On the Error Checking tab, make sure that the Enable background error checking and Text date with 2 digit years check boxes are selected, and then click OK.
  3. In the worksheet, select any cell or range of cells with an error indicator in the upper-left corner Cell with a formula problem.

 Note   The selected cells must be adjacent.

ShowHow to select adjacent cells

To select Do this
A single cell Click the cell, or press the arrow keys to move to the cell.
A range (range: Two or more cells on a sheet. The cells in a range can be adjacent or nonadjacent.) of cells

Click the first cell in the range, and then drag to the last cell, or hold down SHIFT while you press the arrow keys to extend the selection.

You can also select the first cell in the range, and then press F8 to extend the selection by using the arrow keys.

A large range of cells Click the first cell in the range, and then hold down SHIFT while you click the last cell in the range. You can scroll to make the last cell visible.
All cells on a worksheet

Click the Select All button.

Select All button

To select the entire worksheet, you can also press CTRL+A.

 Note   If the worksheet contains data, CTRL+A selects the current region. Pressing CTRL+A a second time selects the entire worksheet.

An entire row or column

Click the row or column heading.

Worksheet showing row heading and column heading

Callout 1 Row heading
Callout 2 Column heading

You can also select cells in a row or column by selecting the first cell and then pressing CTRL+SHIFT+ARROW KEY (RIGHT ARROW or LEFT ARROW for rows, UP ARROW or DOWN ARROW for columns).

 Note   If the row or column contains data, CTRL+SHIFT+ARROW KEY selects the row or column to the last used cell. Pressing CTRL+SHIFT+ARROW KEY a second time selects the entire row or column.

Adjacent rows or columns Drag across the row or column headings. Or select the first row or column; then hold down SHIFT while you select the last row or column.
More or fewer cells than the active selection Hold down SHIFT while you click the last cell that you want to include in the new selection. The rectangular range between the active cell (active cell: The selected cell in which data is entered when you begin typing. Only one cell is active at a time. The active cell is bounded by a heavy border.) and the cell that you click becomes the new selection.
  1. Next to the selected cell or range of cells, click the error button Button image that appears, and then click either Convert XX to 20XX or Convert XX to 19XX.

Top of Page Top of Page

Convert text dates by using the DATEVALUE function

First you'll convert the text date in a cell to a serial number by using the DATEVALUE function. Then you'll copy the formula, select the cells that contain the text dates, and use Paste Special to apply a date format to them.

  1. Select a blank cell and verify that its number format is General.

ShowHow to verify the number format

  1. On the Format menu, click Cells.
  2. Click the Number tab.
  3. In the Category box, make sure that General is selected.
  1. In the blank cell, type =DATEVALUE(, click the cell that contains the text-formatted date that you want to convert, type ), and then press ENTER.

The DATEVALUE function returns the serial number of the date that is represented by the text date.

ShowWhat is a serial number?

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

  1. To copy the conversion formula into a range of contiguous cells, select the cell in which you typed the formula, and then drag the fill handle fill handle image across a range of empty cells that matches in size the range of cells that contain text dates.

After you drag the fill handle, you should have a range of cells with serial numbers that corresponds to the range of cells that contain text dates.

  1. Select the cell or range of cells that contains the serial numbers, and then click Copy on the Edit menu.
  2. Select the cell or range of cells that contains the text dates, and then click Paste Special on the Edit menu.
  3. In the Paste Special dialog box, under Paste, click Values, and then click OK.
  4. On the Format menu, click Cells.
  5. On the Number tab, in the Category box, click Date, and then click a date style in the Type box.

Tip    You can now delete the cells that contain the serial numbers.

Top of Page Top of Page

 
 
Applies to:
Excel 2003