Along with numbers, dates and times are the most coarse data types people use in Excel. however, they may be quite confusing to work with, first, because the like date can be displayed in Excel in a kind of ways, and second, because Excel always internally stores dates in the same format careless of how you have formatted a date in a given cell .
Knowing the Excel date formats a little in depth can help you save a short ton of your time. And this is precisely the bearing of our comprehensive tutorial to working with dates in Excel. In the inaugural part, we will be focusing on the play along features :
Before you can take advantage of powerful Excel date features, you have to understand how Microsoft Excel stores dates and times, because this is the main beginning of confusion. While you would expect Excel to remember the day, calendar month and the class for a date, that ‘s not how it works …
Excel stores dates as consecutive numbers and it is only a cellular telephone ‘s format that causes a act to be displayed as a date, time, or date and meter .
Dates in Excel
All dates are stored as integers representing the number of days since January 1, 1900, which is stored as number 1, to December 31, 9999 stored as 2958465 .
In this organization :
- 2 is 2-Jan-1900
- 3 is 3-Jan-1900
- 42005 is 1-Jan-2015 (because it is 42,005 days after January 1, 1900)
Time in Excel
Times are stored in Excel as decimals, between .0 and .99999, that represent a proportion of the day where .0 is 00:00:00 and .99999 is 23:59:59 .
For case :
- 0.25 is 06:00 AM
- 0.5 is 12:00 PM
- 0.541655093 is 12:59:59 PM
Dates & Times in Excel
Excel stores dates and times as decimal numbers comprised of an integer representing the date and a decimal fraction dowry representing the clock .
For case :
- 1.25 is January 1, 1900 6:00 AM
- 42005.5 is January 1, 2015 12:00 PM
If you want to know what consecutive count represents a certain date or time displayed in a cell, you can do this in two ways .
1. Format Cells dialog
Select the cell with a date in Excel, wardrobe Ctrl+1 to open the Format Cells window and trade to the General yellow journalism .
If you good want to know the serial issue behind the go steady, without actually converting date to number, write down the number you see under Sample and chatter Cancel to close the window. If you want to replace the date with the count in a cell, chink OK.
2. Excel DATEVALUE and TIMEVALUE functions
Use the DATEVALUE ( ) routine to convert an Excel date to a serial number, for exercise
Use the TIMEVALUE ( ) routine to get the decimal number representing the time, for case
=TIMEVALUE("6:30 AM") .
To know both, date and time, concatenate these two functions in the be manner :
=DATEVALUE("1/1/2015") & TIMEVALUE("6:00 AM")
note. Since Excel ‘s serial numbers begins on January 1, 1900 and veto numbers are n’t recognized, dates prior to the year 1900 are not supported in Excel. If you enter such a date in a sheet, say 12/31/1899, it will be a text value quite than a date, meaning that you can not perform usual date arithmetic on early dates. To make certain, you can type the convention
=DATEVALUE("12/31/1899") in some cell, and you will get an anticipated result – the # VALUE ! error .
If you are dealing with date and clock time values and you ‘d like to convert time to decimal number, please check out the formulas described in this tutorial : How to convert time to decimal count in Excel .
When you work with dates in Excel, the abruptly and long date formats are retrieved from your Windows Regional settings. These default formats are marked with an asterisk ( * ) in the Format Cell dialogue windowpane :
The default go steady and clock time formats in the Format Cell box change a soon as you change the date and time settings in Control Panel, which leads us good to the future section .
How to change the default date and time formats in Excel
If you want to set a different default date and/or time formats on your calculator, for model transfer the USA date format to the UK vogue, go to Control panel and click Region and Language. If in your Control gore opens in Category opinion, then chink Clock, Language, and Region > Region and Language > Change the date, time, or number format .
On the Formats yellow journalism, choose the region under Format, and then set the date and time format by clicking on an arrow next to the format you want to change and selecting the coveted one from the drop-down tilt :
Tip. If you are not certain what different codes ( such as mmm, ddd, yyy ) think of, click the “ What does the notation mean ” link under the Date and time formats department, or check the Custom Excel date formats in this tutorial. If you are not happy with any prison term and date format available on the Formats tab key, click the Additional settings release in the lower right side of the Region and Language dialogue window. This will open the Customize dialogue, where you switch to the Date yellow journalism and enter a custom short or/and long date format in the corresponding box.
How to quickly apply default date and time formatting in Excel
Microsoft Excel has two nonpayment formats for dates and fourth dimension – short-circuit and long, as explained in default Excel date format .
To promptly change date format in Excel to the nonpayment format, do the following :
- Select the dates you want to format.
- On the Home tab, in the Number group, click the little arrow next to the Number Format box, and select the desired format – short date, long date or time.
If you want more go steady format options, either select More Number Formats from the drop-down list or click the Dialog Box Launcher adjacent to Number. This will open a familiar Format Cells dialogue and you can change date format there.
Tip. If you want to cursorily set date format in Excel to dd-mmm-yy, wardrobe Ctrl+Shift+ #. Just keep in mind that this shortcut constantly applies the dd-mmm-yy format, like 01-Jan-15, careless of your Windows Region settings. In Microsoft Excel, dates can be displayed in a variety of ways. When it comes to changing go steady format of a given cell or compass of cells, the easiest way is to open the Format Cells dialogue and choose one of the predefined formats .
- Select the dates whose format your want to change, or empty cells where you want to insert dates.
- Press Ctrl+1 to open the Format Cells dialog. Alternatively, you can right click the selected cells and choose Format Cells… from the context menu.
- In the Format Cells window, switch to the Number tab, and select Date in the Category list.
- Under Type, pick a desired date format. Once you do this, the Sample box will display the format preview with the first date in your selected data.
- If you are happy for the preview, click the OK button to save the format change and close the window.
Read more : Preparing for a Hurricane or Tropical Storm
If the date format is not changing in your Excel plane, most likely your dates are formatted as text and you have to convert them to the date format beginning .
once you ‘ve got a file broad of foreign dates and you would most likely want to change them to the date format used in your contribution of the universe. Let ‘s say, you want to convert an american date format ( month/day/year ) to a european vogue format ( day/month/year ) .
The easiest way to change date format in Excel based on how another terminology expose dates is as follows :
- Select the column of dates you want to convert to another locale.
- Press Ctrl+1 to open the Format Cells
- Select the language you want under Locale (location) and click OK to save the change.
If you want the dates to be displayed in another linguistic process, then you will have to create a custom date format with a venue code .
If none of the predefined Excel date formats is desirable for you, you are absolve to create your own .
- In an Excel sheet, select the cells you want to format.
- Press Ctrl+1 to open the Format Cells dialog.
- On the Number tab, select Custom from the Category list and type the date format you want in the Type box.
- Click OK to save the changes.
Tip. The easiest way to set a customs date format in Excel is to start from an existing format close to what you want. To do this, chink Date in the Category number first, and select one of existing formats under Type. After that pawl Custom and make changes to the format displayed in the Type box. When setting up a custom date format in Excel, you can use the be codes .
|Code||Description||Example (January 1, 2005)|
|m||Month number without a leading zero||1|
|mm||Month number with a leading zero||01|
|mmm||Month name, short form||Jan|
|mmmm||Month name, full form||January|
|mmmmm||Month as the first letter||J (stands for January, June and July)|
|d||Day number without a leading zero||1|
|dd||Day number with a leading zero||01|
|ddd||Day of the week, short form||Mon|
|dddd||Day of the week, full form||Monday|
|yy||Year (last 2 digits)||05|
|yyyy||Year (4 digits)||2005|
When setting up a custom time format in Excel, you can use the keep up codes .
|h||Hours without a leading zero||0-23|
|hh||Hours with a leading zero||00-23|
|m||Minutes without a leading zero||0-59|
|mm||Minutes with a leading zero||00-59|
|s||Seconds without a leading zero||0-59|
|ss||Seconds with a leading zero||00-59|
|AM/PM||Periods of the day
(if omitted, 24-hour time format is used)
|AM or PM|
To set up date and time format, include both date and time units in your format code, e.g. m/d/yyyy henry : millimeter AM/PM. When you use “ m ” immediately after “ hh ” or “ planck’s constant ” or immediately before “ s ” or “ south ”, Excel will display minutes, not a month .
When creating a custom-made date format in Excel, you can use a comma (, ) dash ( – ), slash ( / ), colon ( : ) and early characters .
For example, the same go steady and time, say January 13, 2015 13:03, can be displayed in a versatile ways :
|dddd, m/d/yy h:mm AM/PM||Tuesday, 1/13/15 1:03 PM|
|ddd, mmmm dd, yyyy hh:mm:ss||Tue, January 13, 2015 13:03:00|
If you want to display dates in another lyric, you have to create a customs format and prefix a date with a match venue code. The venue code should be enclosed in [ hearty brackets ] and preceded with the dollar signal ( $ ) and a smash ( – ). here are a few examples :
- [$-409] – English, Untitled States
- [$-1009] – English, Canada
- [$-407] – German, Germany
- [$-807] – German, Switzerland
- [$-804] – Bengali, India
- [$-804] – Chinese, China
- [$-404] – Chinese, Taiwan
You can find the full list of venue codes on this blog .
For exemplar, this is how you set up a custom Excel date format for the chinese venue in the year-month-day ( day of the week ) time format :
The pursuit double shows a few examples of the same date formatted with different venue codes in the means traditional for the corresponding languages :
normally, Microsoft Excel understands dates very well and you are unlikely to hit any barrier when working with them. If you happen to have an Excel date format trouble, please check out the following trouble-shoot tips .
A cell is not wide enough to fit an entire date
If you see a number of pound signs ( # # # # # ) alternatively of dates in your Excel worksheet, most likely your cells are not wide enough to fit the whole dates .
Solution. Double-click the properly bound of the column to resize it to car fit the dates. alternatively, you can drag the right surround to set the column width you want .
Negative numbers are formatted as dates
Hash marks ( # # # # # ) are besides displayed when a cellular telephone formatted as a date or time contains a damaging value. Usually it ‘s a result returned by some formula, but it may besides happen when you type a negative value into a cell and then format that cell as a date .
If you want to display negative numbers as negative dates, two options are available to you :
Solution 1. Switch to the 1904 date system.
Go to File > Options > Advanced, scroll down to the When calculating this workbook incision, select the Use 1904 date system check box, and click OK.
In this system, 0 is 1-Jan-1904 ; 1 is 2-Jan-1904 ; and -1 is displayed as a negative date -2-Jan-1904.
Of course, such representation is very strange and takes time to get used to, but this is the right way to go if you want to perform calculations with early dates .
Solution 2. Use the Excel TEXT function.
Another potential way to display negative numbers as negative dates in Excel is using the TEXT routine. For example, if you are subtracting C1 from B1 and a value in C1 is greater than in B1, you can use the trace rule to output signal the consequence in the date format :
You may want to change the cell conjunction to right justify, and naturally, you can use any other custom date formats in the TEXT formula .
note. Unlike the former solution, the TEXT affair returns a text value, that is why you wo n’t be able to use the consequence in early calculations .
Dates are imported to Excel as text values
When you are importing data to Excel from a .csv file or some other external database, dates are often imported as text values. They may look like normal dates to you, but Excel perceives them as text and treats consequently.
Solution. You can convert “ text dates ” to the date format using Excel ‘s DATEVALUE function or text to Columns feature. Please see the following article for entire details : How to convert text to date in Excel .
Tip. If none of the above tips worked for you, then try to remove all format and then set the desire go steady format .
This is how you format dates in Excel. In the adjacent part of our guide, we will discuss diverse ways of how you can insert dates and times in your Excel worksheets. Thank you for reading and see you future workweek !