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 date 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. In addition, if Error Checking is turned on, text dates with two-digit years may also be marked with an error indicator .
Because Error Checking in 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-formatted dates to dates.
What do you want to do?
Convert text dates by using Error Checking
If you import data into Excel from another source, or if you type dates with two-digit years into cells that were previously formatted as text, you may see a small green triangle in the upper-left corner of the cell. This error indicator tells you that the date is stored as text, as shown in this example.
Use the following procedure to convert the text-formatted date back to a regular date.
On the worksheet, select any single cell or range of adjacent cells that has an error indicator in the upper-left corner.
How to select cells, ranges, rows, or columns
A single cell
Click the cell, or press the arrow keys to move to the cell.
A range 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. To stop extending the selection, press F8 again.
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.
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.
Nonadjacent cells or cell ranges
Select the first cell or range of cells, and then hold down Ctrl while you select the other cells or ranges.
You can also select the first cell or range of cells, and then press Shift+F8 to add another nonadjacent cell or range to the selection. To stop adding cells or ranges to the selection, press Shift+F8 again.
Note: You cannot cancel the selection of a cell or range of cells in a nonadjacent selection without canceling the entire selection.
An entire row or column
Click the row or column heading.
1. Row heading
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.
Nonadjacent rows or columns
Click the column or row heading of the first row or column in your selection; then hold down Ctrl while you click the column or row headings of other rows or columns that you want to add to the selection.
The first or last cell in a row or column
Select a cell in the row or column, and then press Ctrl+Arrow key (Right Arrow or Left Arrow for rows, Up Arrow or Down Arrow for columns).
The first or last cell on a worksheet or in a Microsoft Office Excel table
Press Ctrl+Home to select the first cell on the worksheet or in an Excel list.
Press Ctrl+End to select the last cell on the worksheet or in an Excel list that contains data or formatting.
Cells to the last used cell on the worksheet (lower-right corner)
Select the first cell, and then press Ctrl+Shift+End to extend the selection of cells to the last used cell on the worksheet (lower-right corner).
Cells to the beginning of the worksheet
Select the first cell, and then press Ctrl+Shift+Home to extend the selection of cells to the beginning of the worksheet.
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 and the cell that you click becomes the new selection.
Tip: To cancel a selection of cells, click any cell on the worksheet.
Next to the selected cell or range of cells, click the error button that appears.
On the menu, click either Convert XX to 20XX or Convert XX to 19XX. (If you want to simply get rid of the error indicator without converting the number, click Ignore Error.)
This action converts the text dates with two-digit years to standard dates with four-digit years.
Once you have converted the cells from text-formatted dates, you can change the way the dates appear in the cells by applying date formatting.
Convert text dates by using the DATEVALUE function
To convert a text date in a cell to a serial number, you use the DATEVALUE function. Then you copy the formula, select the cells that contain the text dates, and use Paste Special to apply a date format to them.
Select a blank cell and verify that its number format is General.
How to verify the number format
On the Home tab, in the Number group, click the arrow next to the Number Format box, and then click General.
In the blank cell:
Click the cell that contains the text-formatted date that you want to convert.
The DATEVALUE function returns the serial number of the date that is represented by the text date.
What 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.
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 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.
Select the cell or range of cells that contain the serial numbers and press Ctrl+C, or on the Home tab, in the Clipboard group, click Copy.
Select the cell or range of cells that contains the text dates, and then on the Home tab, in the Clipboard group, click the arrow below Paste, and then click Paste Special.
In the Paste Special dialog box, under Paste, select Values, and then click OK.
On the Home tab, click the Dialog Box Launcher next to Number.
In the Category box, click Date, and then click the date format that you want in the Type list.
To delete the serial numbers after all of the dates are converted successfully, select the cells that contain them, and then press Delete.
Turn off Error Checking
With error checking turned on in Excel, you see an error indicator if you enter a date with a two-digit year into a cell that has text formatting applied to it. If you want, you can turn off this Error Checking feature.
Click the File tab.
In the Excel Options dialog box, click the Formulas category.
Under Error checking rules, clear the Cells containing years represented as 2 digits check box.