When a date or time is typed in a cell, it appears in a default date and time format. The default date and time format is based on the regional date and time settings that are specified in Control Panel, and changes when changes are made to those settings. You can display numbers in several other date and time formats, most of which are not affected by Control Panel settings.
Select the cells that you want to format.
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.
On the Home tab, in the Number group, click the Dialog Box Launcher next to Number.
In the Category list, click Date or Time.
In the Type list, click the date or time format that you want to use.
Note: Date and time formats that begin with an asterisk (*) respond to changes in regional date and time settings that are specified in Control Panel. Formats without an asterisk are not affected by Control Panel settings.
Tip: If you do not find the format that you are looking for in the Type list, you can create a custom number format by clicking Custom in the Category list, and then by using format codes for dates and times.
Learn about custom date and time codes
Days, months, and years If you use "m" immediately after the "h" or "hh" code or immediately before the "ss" code, Microsoft Office Excel displays minutes instead of the month.
Use this code
Months as 1–12
Months as 01–12
Months as Jan–Dec
Months as January–December
Months as the first letter of the month
Days as 1–31
Days as 01–31
Days as Sun–Sat
Days as Sunday–Saturday
Years as 00–99
Years as 1900–9999
Hours, minutes, and seconds
Use this code
Hours as 0–23
Hours as 00–23
Minutes as 0–59
Minutes as 00–59
Seconds as 0–59
Seconds as 00–59
Hours as 4 AM
Time as 4:36 PM
Time as 4:36:03 P
Elapsed time in hours; for example, 25.02
Elapsed time in minutes; for example, 63:46
Elapsed time in seconds
Fractions of a second
AM and PM If the format contains an AM or PM, the hour is based on the 12-hour clock, where "AM" or "A" indicates times from midnight until noon and "PM" or "P" indicates times from noon until midnight. Otherwise, the hour is based on the 24-hour clock. The "m" or "mm" code must appear immediately after the "h" or "hh" code or immediately before the "ss" code; otherwise, Microsoft Office Excel displays the month instead of minutes.
To display dates and times in the format of other languages, click the language setting that you want in the Locale (location) box.
Dates or times that you enter in formatted cells will be displayed in the format that you selected.
The number in the active cell of the selection on the worksheet appears in the Sample box, so that you can preview the number formatting options that you select.
To quickly format a date or time, click the date or time format that you want in the Number Format box in the Number group on the Home tab.
If you want to use the default date or time format, click the cell that contains the date or time, and then press CTRL+SHIFT+# or CTRL+SHIFT+@.
A cell might display ##### when it contains data that has a number format that is wider than the column width. To see all text, you must increase the width of the column.
How to change the column width
Click the cell for which you want to change the column width.
On the Home tab, in the Cells group, click Format.
Under Cell Size, do one of the following:
To fit all text in the cell, click AutoFit Column Width.
To specify a larger column width, click Column Width, and then type the width that you want in the Column width box.
When you try to undo a date or time format by selecting General in the Category list, Excel displays a number code. When you enter a date or time again, Excel displays the default date or time format. To enter a specific date or time format, such as January 2005, you can format it as text by selecting Text in the Category list.