How To Keep Excel From Formatting Date

Stop automatically changing numbers to dates

Microsoft Excel is preprogrammed to make it easier to enter dates. For example, 12/2 changes to 2-Dec. This is very frustrating when you enter something that you don’t want changed to a date. Unfortunately there is no way to turn this off. But there are ways to get around it.

Preformat the cells you want to enter numbers into as Text. This way Excel will not try to change what you enter into dates.

If you only have a few numbers to enter, you can stop Excel from changing them into dates by entering:

A space before you enter a number. The space remains in the cell after you press Enter. (See Notes)

An apostrophe (‘) before you enter a number, such as ’11-53 or ‘1/47. The apostrophe isn’t displayed in the cell after you press Enter.

A zero and a space before you enter a fraction such as 1/2 or 3/4 so that they don’t change to 2-Jan or 4-Mar, for example. Type 0 1/2 or 0 3/4. The zero doesn’t remain in the cell after you press Enter, and the cell becomes the Fraction number type.

Select the cells that you’ll enter numbers into.

Press Ctrl + 1 (the 1 in the row of numbers above the QWERTY keys) to open Format Cells.

Select Text, and then click OK.

Select the cells you want to enter numbers into.

Click Home > Number Format > Text.

We recommend using an apostrophe instead of a space for entering data if you plan on using lookup functions against the data. Functions like MATCH or VLOOKUP overlook the apostrophe when calculating the results.

If a number is left-aligned in a cell that usually means it isn’t formatted as a number.

If you type a number with an “e” in it, such as 1e9, it will automatically result in a scientific number: 1.00E+09. If you don’t want a scientific number, enter an apostrophe before the number: ‘1e9

Depending on the number entered, you may see a small green triangle in the upper left corner of the cell, indicating that a number is stored as text, which to Excel is an error. Either ignore the triangle, or click on it. A box will appear to the left. Click the box, and then select Ignore Error, which will make the triangle go away.

Need more help?

You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice.

Format a date the way you want

When you enter some text into a cell such as " 2/2", Excel assumes that this is a date and formats it according to the default date setting in Control Panel. Excel might format it as " 2-Feb". If you change your date setting in Control Panel, the default date format in Excel will change accordingly. If you don’t like the default date format, you can choose another date format in Excel, such as " February 2, 2012" or " 2/2/12". You can also create your own custom format in Excel desktop.

Follow these steps:

Select the cells you want to format.

In the Format Cells box, click the Number tab.

In the Category list, click Date.

Under Type, pick a date format. Your format will preview in the Sample box with the first date in your data.

Note: Date formats that begin with an asterisk (*) will change if you change the regional date and time settings in Control Panel. Formats without an asterisk won’t change.

If you want to use a date format according to how another language displays dates, choose the language in Locale (location).

Tip: Do you have numbers showing up in your cells as #####? It’s likely that your cell isn’t wide enough to show the whole number. Try double-clicking the right border of the column that contains the cells with #####. This will resize the column to fit the number. You can also drag the right border of the column to make it any size you want.

If you want to use a format that isn’t in the Type box, you can create your own. The easiest way to do this is to start from a format this is close to what you want.

Select the cells you want to format.

In the Format Cells box, click the Number tab.

In the Category list, click Date, and then choose a date format you want in Type. You can adjust this format in the last step below.

Go back to the Category list, and choose Custom. Under Type, you’ll see the format code for the date format you chose in the previous step. The built-in date format can’t be changed, so don’t worry about messing it up. The changes you make will only apply to the custom format you’re creating.

In the Type box, make the changes you want using code from the table below.

Months as Jan–Dec

Months as January–December

Months as the first letter of the month

Days as Sunday–Saturday

Years as 1900–9999

If you’re modifying a format that includes time values, and you use "m" immediately after the "h" or "hh" code or immediately before the "ss" code, Excel displays minutes instead of the month.

To quickly use the default date format, click the cell with the date, and then press CTRL+SHIFT+#.

If a cell displays ##### after you apply date formatting to it, the cell probably isn’t wide enough to show the whole number. Try double-clicking the right border of the column that contains the cells with #####. This will resize the column to fit the number. You can also drag the right border of the column to make it any size you want.

To quickly enter the current date in your worksheet, select any empty cell, press CTRL+; (semicolon), and then press ENTER, if necessary.

To enter a date that will update to the current date each time you reopen a worksheet or recalculate a formula, type =TODAY() in an empty cell, and then press ENTER.

When you enter some text into a cell such as " 2/2", Excel assumes that this is a date and formats it according to the default date setting in Control Panel. Excel might format it as " 2-Feb". If you change your date setting in Control Panel, the default date format in Excel will change accordingly. If you don’t like the default date format, you can choose another date format in Excel, such as " February 2, 2012" or " 2/2/12". You can also create your own custom format in Excel desktop.

Follow these steps:

Select the cells you want to format.

Press Control+1 or Command+1.

In the Format Cells box, click the Number tab.

In the Category list, click Date.

Under Type, pick a date format. Your format will preview in the Sample box with the first date in your data.

Note: Date formats that begin with an asterisk (*) will change if you change the regional date and time settings in Control Panel. Formats without an asterisk won’t change.

If you want to use a date format according to how another language displays dates, choose the language in Locale (location).

Tip: Do you have numbers showing up in your cells as #####? It’s likely that your cell isn’t wide enough to show the whole number. Try double-clicking the right border of the column that contains the cells with #####. This will resize the column to fit the number. You can also drag the right border of the column to make it any size you want.

If you want to use a format that isn’t in the Type box, you can create your own. The easiest way to do this is to start from a format this is close to what you want.

Select the cells you want to format.

Press Control+1 or Command+1.

In the Format Cells box, click the Number tab.

In the Category list, click Date, and then choose a date format you want in Type. You can adjust this format in the last step below.

Go back to the Category list, and choose Custom. Under Type, you’ll see the format code for the date format you chose in the previous step. The built-in date format can’t be changed, so don’t worry about messing it up. The changes you make will only apply to the custom format you’re creating.

In the Type box, make the changes you want using code from the table below.

How to change date format in Excel and create custom formatting

The first part of our tutorial focuses of formatting dates in Excel and explains how to set the default date and time formats, how to change date format in Excel, how to create custom date formatting, and convert your dates to another locale.

Along with numbers, dates and times are the most common data types people use in Excel. However, they may be quite confusing to work with, firstly, because the same date can be displayed in Excel in a variety of ways, and secondly, because Excel always internally stores dates in the same format regardless 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 ton of your time. And this is exactly the aim of our comprehensive tutorial to working with dates in Excel. In the first part, we will be focusing on the following features:

Excel date format

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 source of confusion. While you would expect Excel to remember the day, month and the year for a date, that’s not how it works.

Excel stores dates as sequential numbers and it is only a cell’s formatting that causes a number to be displayed as a date, time, or date and time.

Dates in Excel

All dates are stored asintegersrepresenting the number of days since January 1, 1900, which is stored as number 1, to December 31, 9999 stored as 2958465.

  • 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.

  • 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 portion representing the time.

  • 1.25 is January 1, 1900 6:00 AM
  • 42005.5 is January 1, 2015 12:00 PM

How to convert date to number in Excel

If you want to know what serial number 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, press Ctrl+1 to open theFormat Cellswindow and switch to theGeneraltab.

If you just want to know the serial number behind the date, without actually converting date to number, write down the number you see underSampleand clickCancelto close the window. If you want to replace the date with the number in a cell, click OK.

2. Excel DATEVALUE and TIMEVALUE functions

Use the DATEVALUE() function to convert an Excel date to a serial number, for example =DATEVALUE("1/1/2015") .

Use the TIMEVALUE() function to get the decimal number representing the time, for example =TIMEVALUE("6:30 AM") .

To know both, date and time, concatenate these two functions in the following way:

=DATEVALUE("1/1/2015") & TIMEVALUE("6:00 AM")

If you enter such a date in a sheet, say 12/31/1899, it will be a text value rather than a date, meaning that you cannot perform usual date arithmetic on early dates. To make sure, you can type the formula =DATEVALUE("12/31/1899") in some cell, and you will get an anticipated result – the #VALUE! error.

If you are dealing with date and time values and you’d like to converttime to decimal number, please check out the formulas described in this tutorial: How to convert time to decimal number in Excel.

Default date format in Excel

When you work with dates in Excel, the short and long date formats are retrieved from your Windows Regional settings. These default formats are marked with an asterisk (*) in theFormat Celldialog window:

The default date and time formats in theFormat Cellbox change as soon as you change the date and time settings in Control Panel, which leads us right to the next 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 computer, for example change the USA date format to the UK style, go to Control panel and clickRegion and Language.If in your Control panel opens in Category view, then clickClock, Language, and Region>Region and Language > Change the date, time, or number format.

On theFormatstab, choose the region underFormat, and then set the date and time formatting by clicking on an arrow next to the format you want to change and selecting the desired one from the drop-down list:

If you are not happy with any time and date format available on theFormatstab, click theAdditional settingsbutton in the lower right-hand side of theRegion and Languagedialog window. This will open theCustomizedialog, where you switch to theDatetab 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 default formats for dates and time – short and long, as explained in default Excel date format.

To quickly change date format in Excel to the default formatting, do the following:

  • Select the dates you want to format.
  • On theHometab, in theNumbergroup, click the little arrow next to theNumber Formatbox, and select the desired format – short date, long date or time.

If you want more date formatting options, either selectMore Number Formatsfrom the drop-down list or click theDialog Box Launchernext toNumber. This will open a familiarFormat Cellsdialog and you can change date format there.

How to change date format in Excel

In Microsoft Excel, dates can be displayed in a variety of ways. When it comes to changing date format of a given cell or range of cells, the easiest way is to open theFormat Cellsdialog and choose one of the predefined formats.

  1. Select the dates whose format your want to change, or empty cells where you want to insert dates.
  2. Press Ctrl+1 to open theFormat Cellsdialog. Alternatively, you can right click the selected cells and chooseFormat Cells…from the context menu.
  3. In theFormat Cellswindow, switch to theNumbertab, and selectDatein theCategorylist.
  4. UnderType, pick a desired date format. Once you do this, theSamplebox will display the format preview with the first date in your selected data.
  5. If you are happy for the preview, click theOKbutton to save the format change and close the window.

If the date format is not changing in your Excel sheet, most likely your dates are formatted as text and you have to convert them to the date format first.

How to convert date format to another locale

Once you’ve got a file full of foreign dates and you would most likely want to change them to the date format used in your part of the world. Let’s say, you want to convert an American date format (month/day/year) to a European style format (day/month/year).

The easiest way to change date format in Excel based on how another language displays dates is as follows:

  • Select the column of dates you want to convert to another locale.
  • Press Ctrl+1 to open theFormat 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 language, then you will have to create a custom date format with a locale code.

Creating a custom date format in Excel

If none of the predefined Excel date formats is suitable for you, you are free to create your own.

  1. In an Excel sheet, select the cells you want to format.
  2. Press Ctrl+1 to open theFormat Cellsdialog.
  3. On theNumbertab, selectCustomfrom theCategorylist and type the date format you want in theTypebox.
  4. Click OK to save the changes.

When setting up acustom dateformat in Excel, you can use the following codes.

CodeDescriptionExample (January 1, 2005)
mMonth number without a leading zero1
mmMonth number with a leading zero01
mmmMonth name, short formJan
mmmmMonth name, full formJanuary
mmmmmMonth as the first letterJ (stands for January, June and July)
dDay number without a leading zero1
ddDay number with a leading zero01
dddDay of the week, short formMon
ddddDay of the week, full formMonday
yyYear (last 2 digits)05
yyyyYear (4 digits)2005

When setting up acustom timeformat in Excel, you can use the following codes.

CodeDescriptionDisplays as
hHours without a leading zero0-23
hhHours with a leading zero00-23
mMinutes without a leading zero0-59
mmMinutes with a leading zero00-59
sSeconds without a leading zero0-59
ssSeconds with a leading zero00-59
AM/PMPeriods of the day
(if omitted, 24-hour time format is used)
AM or PM

When creating a custom date format in Excel, you can use a comma (,) dash (-), slash (/), colon (:) and other characters.

For example, the same date and time, sayJanuary 13, 2015 13:03, can be displayed in a various ways:

FormatDisplays as
dd-mmm-yy13-Jan-15
mm/dd/yyyy01/13/2015
m/dd/yy1/13/15
dddd, m/d/yy h:mm AM/PMTuesday, 1/13/15 1:03 PM
ddd, mmmm dd, yyyy hh:mm:ssTue, January 13, 2015 13:03:00

How to create a custom Excel date format for another locale

If you want to display dates in another language, you have to create a custom format and prefix a date with a corresponding locale code. The locale code should be enclosed in [square brackets] and preceded with the dollar sign ($) and a dash (-). 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 locale codes on this blog.

For example, this is how you set up a custom Excel date format for the Chinese locale in theyear-month-day (day of the week) timeformat:

The following image shows a few examples of the same date formatted with different locale codes in the way traditional for the corresponding languages:

Excel date format not working – fixes and solutions

Usually, Microsoft Excel understands dates very well and you are unlikely to hit any roadblock when working with them. If you happen to have an Excel date format problem, please check out the following troubleshooting tips.

A cell is not wide enough to fit an entire date

If you see a number of pound signs (#####) instead of dates in your Excel worksheet, most likely your cells are not wide enough to fit the whole dates.

Solution. Double-click the right border of the column to resize it to auto fit the dates. Alternatively, you can drag the right border to set the column width you want.

Negative numbers are formatted as dates

In all modern versions of Excel 2013, 2010 and 2007, hash marks (#####) are also displayed when a cell formatted as a date or time contains a negative value. Usually it’s a result returned by some formula, but it may also 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 toFile>Options>Advanced, scroll down to theWhen calculating this workbooksection, select theUse 1904 date systemcheck box, and clickOK.

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 unusual 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 possible way to display negative numbers as negative dates in Excel is using the TEXT function. For example, if you are subtracting C1 from B1 and a value in C1 is greater than in B1, you can use the following formula to output the result in the date format:

=TEXT(ABS(B1-C1),"-d-mmm-yyyy")

You may want to change the cell alignment to right justified, and naturally, you can use any other custom date formats in the TEXT formula.

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 accordingly.

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 full details: How to convert text to date in Excel.

This is how you format dates in Excel. In the next part of our guide, we will discuss various ways of how you can insert dates and times in your Excel worksheets. Thank you for reading and see you next week!

Convert date to text

If you need to convert dates to text (i.e. date to string conversion) , you can use the TEXT function. The TEXT function can use patterns like "dd/mm/yyyy", "yyyy-mm-dd", etc. to convert a valid date to a text value. See table below for a list of available tokens.

How this formula works

Dates and times in Excel are stored as serial numbers and converted to human readable values on the fly using number formats. When you enter a date in Excel, you can apply a number format to display that date as you like. In a similar way, the TEXT function allows you to convert a date or time into text in a preferred format. For example, if the date January 9, 2000 is entered in cell A1, you can use TEXT to convert this date into the following text strings as follows:

Date format codes

Assuming a date of January 9, 2012, here is a more complete set of formatting codes for date, along with sample output.

Format codeOutput
d9
dd09
dddMon
ddddMonday
m1
mm01
mmmJan
mmmmJanuary
mmmmmJ
yy12
yyyy2012
mm/dd/yyyy01/09/2012
m/d/y1/9/12
ddd, mmm dMon, Jan 9
mm/dd/yyyy h:mm AM/PM01/09/2012 5:15 PM
dd/mm/yyyy hh:mm:ss09/01/2012 17:15:00

You can use TEXT to convert dates or any numeric value in a fixed format. You can explore available formats by navigating to Format Cells (Win: Ctrl + 1, Mac: Cmd + 1) and selecting various format categories in the list to the left.

Comments: