Formatting cells in excel numbers

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 More…Less

Apply number formats such as dates, currency, or fractions to cells in a worksheet. For example, if you’re working on your quarterly budget, you can use the Currency number format so your numbers represent money. Or, if you have a column of dates, you can specify that you want the dates to appear as March 14, 2012, 14-Mar-12, or 3/14.

Follow these steps to format numbers:

  1. Select the cells containing the numbers you need to format.

  2. Select CTRL+1.

    On a Mac, select Control+1, or Command+1.

  3. In the window that displays, select the Number tab (skip this step if you’re using Microsoft 365 for the web).

  4. Select a Category option, and then select specific formatting changes on the right.

    Format Cells dialog box

Tip: Do you have numbers showing up in your cells as #####? This probably means 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 change the column width and row height to fit the number. You can also drag the right border of the column to make it any size you want.

Stop your numbers from automatically formatting

Sometimes if you enter numbers into a cell—or import them from another data source—Excel doesn’t format them as you expect. If, for example, you type a number along with a slash mark (/) or a hyphen (-), Excel might apply a Date format. You can prevent this automatic number formatting by applying the Text format to the cells.

It’s easy to do:

  1. Select the cells that contain numbers you don’t want Excel to automatically format.

  2. Select CTRL+1.

    On a Mac, select Control+1, or Command+1.

  3. On the Number tab, select Text in the Category list.

    Save as Text in the Format Cells dialog box

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

See Also

Format a date the way you want

Format numbers as percentages

Format negative percentages to make them easy to find

Format numbers as currency

Create a custom number format

Convert dates stored as text to dates

Fix text-formatted numbers by applying a number format

Need more help?

Skip to content

Number Formatting in Excel: Step-by-Step Tutorial (2023)

Number Formatting in Excel: Step-by-Step Tutorial (2023)

We all know how to apply the basic numeric and text formats to cells in Excel.

But do you know how you can add a desired number of decimals, scientific notations, currency symbols, and similar formats in Excel with only a click?

No? This article is for you. It delves into the details of number formatting in Excel. 🤩

Keep reading till the end, and download our free sample workbook here before you scroll down.

What are number formats?

Type something into a cell. What is its format?

General Format

By default, all cells of Excel will have the General format applied.

However, type in a big number that exceeds the size of the cell, and Excel would give you back something like 1.2E+12.

Scientific notation

What is this? A scientific notation. Under General format, Excel replaces a number too big to fit the cell with its scientific notation.

To turn it into a number, change the format to ‘Numbers’ and adjust the cell size.

Changing number formats

Check the formula bar to note how the number remains the same under both formats i.e. 1200000000000.

What changes is only the visual representation of the said number in Excel (decimal places added).

Kasper Langmann, Microsoft Office Specialist

That is how formats work in Excel.

And you can change the format of a number with a mere click. Excel offers many number formats with useful variations to them.

Thousands separator

In the image below we have different numbers.

Numbers in Excel

By now, it only seems like a number that is hard to read. Maybe that’s because it doesn’t yet have 1000s separators (any commas) to it.

  1. Select the cell.
  2. Go to Home > Number
Home > Number
  1. From the menu, go to More Number Formats
This launches the Format Cells dialog box.

This launches the Format Cells dialog box.

You may use the keyboard shortcut (Control Key + 1) to launch the Format Cells dialog box.

Kasper Langmann, Microsoft Office Specialist
Format Cells dialogue box
  1. Go to Number Format.
  2. Check the ‘Use 1000 Separator’ box.
Use 1000 Separator box
  1. Here are the results.
Thousand Separators added

A shortcut to add the 1000s separator: Go to Home > Number > click on the comma symbol

Click on the comma symbol

However, this changes the number format to the Accounting format.

Format changed to accounting

Controlling decimals

In the same example, as above, there are two decimals to the number.

Two decimals to the number

But you want four decimal places to this number. How can this be done?

  1. Select the cell.
  2. Go to Home > Number > More Number Formats
More Number Formats
  1. From the Format Cells dialog box, go to Number Format.
  2. Adjust the decimal places to four.
Decimal places to four
  1. Here are the results.
Decimal places set to four

A shortcut to adjust decimal places. Go to Home > Number > Add decimals button

Add decimals button

With every click, Excel adds another decimal position to the number.

The button with a right-headed arrow reduces a decimal position.

The button with a left-headed arrow adds a decimal position.

Kasper Langmann, Microsoft Office Specialist

Show as percentage

Here is a decimal number that we want to be converted into a percentage.

Decimal to be converted into percentage

To do this:

  1. Select the cell.
  2. Go to Home > Number > More Number Formats
More Number Format code
  1. From the Format Cells dialog box, go to Number Format.
  2. Click on Percentage.
Percentage
  1. Adjust the decimal places as desired.
Decimal places
  1. Here are the results.
Percentage to the desired decimals added

A shortcut to convert a number into a percentage. Go to Home > Number > Click the % symbol

The % symbol

Number formatting presets

Excel offers a wide variety of number formatting presets. (You must’ve had a slight idea of that by now.)

These range from currency to accounting to dates and whatnot.

Let’s look into each of these formats below.

General number format preset

The general number format of Excel is the default format of any value in Excel.

All values in all cells of Excel will have the general number format by default.

  1. To apply the general format to any cell in Excel, select that cell.
  2. Press the Control key + 1 to launch the Format cells dialog box. That’s a handy shortcut 😊.
  3. Choose the ‘General number’ format.
Cell format changed to general number format
  1. Values formatted as general numbers are displayed just the way they are.

Pro Tip!

Under the General number format, if the cell is not wide enough to contain a number, Excel would:

  1. Round a number with decimals to lesser decimal places; or
  2. Use scientific notation to express the number; or
  3. If the cell is too small to fit in the scientific notation for the number even, display a series of hashes only.

Number format preset

The Excel number format is used for simple numeric values

To apply the number format to any cell:

  1. Select the cell.
  2. Go to Home > Numbers > Drop Down Menu and click on Number Format.
Number Formatting

The number format allows users three further variations to the final value:

  1. The decimal places. You can adjust decimal places to any desired number.
Adjusting the decimal places
  1. The 1000 Separator. Check the box if you need 1000s separators to the value.
The 1000 Separator
  1. The format of negative numbers. This could be in two colors (black or red) and enclosed within brackets or with a minus sign.
Choosing the negative number format

The Sample box gives a preview of what the final value may look like.

Number formatted

Must Note:

Under the Numbers format, if you type a number in a cell that is too big to fit in the cell, Excel might return a series of hashes only.

Series of hashes

In such a case, one must know that the problem simply lies within the size of the cell. (that is too small to fit in the cell value).

To work this out, increase the width of the column until it is wide enough to fit in the cell value.

Increasing the column width

Currency format preset

The Currency format is used to denote currencies.

To format a number as currency:

  1. Go to Home > Numbers > Drop Down Menu > Click on Currency.
Number formatting as currency

It allows you to adjust three options to your desire:

  1. The decimal places.
Adjusting the decimal places
  1. The currency symbol.
Adjusting the currency symbol
  1. The format of negative numbers. This could be in two colors (black or red) and enclosed within brackets or with a minus sign.
Choosing the negative number format

Here is what a currency formatted number looks like.

Currency formatted

Date format presets

There are two date formats offered by Excel – short date and long date.

Date format in Excel

To format a number as a date, go to Format Cells and choose the date format you’d want to be applied.

Different date formats

Excel offers a wide variety of formats for dates and days.

Here is how the date format works.

Formatting numbers as dates

Pro Tip!

Type any number into Excel and apply the date formatting to it. Excel turns it into a date.

This is because Excel recognizes each date as a number. Where 1 is equal to 01 Jan 1900, 2 is equal to 02 Jan 1900, and so on.

Accounting format preset

Next is the accounting format preset.

This format is relevant when you’re working with financial data. For example, while preparing financial statements, forecasts, or similar reports.

To apply accounting format to a number:

  1. Go to Home > Numbers > Drop Down Menu > Click on Accounting Format.
Number formatting to accounting format

It allows you to adjust two features to your desire:

  1. The decimal places.
Adjusting the decimal places
  1. The currency symbol.
Adjusting the currency symbol

Here is what an accounting formatted number looks like.

Accounting formatting

Under the accounting format, 1000s separators and currency symbols are added by default. And negative numbers are enclosed in parenthesis i.e. $ (1925.60) etc.

Kasper Langmann, Microsoft Office Specialist

Time format preset

Excel also offers a wide variety of ways how you may represent times in Excel.

To apply the time format, go to Format Cells and choose the time format you’d want to apply.

Different time formats

You can format it to be displayed as HH:MM:SS or any other way you like.

Here is how the time format looks in action.

 Formatting as time

Formatting shortcuts

There are plenty of shortcuts on how you may quickly format cell values in Excel.

You can format numbers by using these keyboard shortcuts. Simply select the cell (or cells) where you want the formatting applied and use the shortcuts below.

  • Control Key + Shift Key + ~ : Applies the General format
  • Control Key + Shift Key + ! : Applies the Number format
  • Control Key + Shift Key + $ : Applies the Currency format
  • Control Key + Shift Key + % : Applies the Percentage format
  • Control Key + Shift Key + ^ : Applies the Scientific notation format
  • Control Key + Shift Key + # : Applies the Date format
  • Control Key + Shift Key + @ : Applies the Time format

All of these are shortcut keys and only apply the default formats (like the default two decimal places or HH:MM:SS AM/PM format etc.)

Kasper Langmann, Microsoft Office Specialist

Custom formatting

Tired already? However, the number formats list has yet not come to an end.

The last and the most important number format of Excel is the Custom Format.

Under this format, you can customize a number format as needed.

  1. Go to Home > Numbers > Drop Down Menu > More Number Formats.
  2. Click on Custom Format.
Custom formats
  1. Under the custom formatting, you see different formats.
Custom Number formats
  1. To create a custom number format, choose the format that closely matches what you are looking for.
  2. Customize it as needed (keep an eye on the sample to see if you’ve reached your desired format).
  3. And save your custom number format.

That’s it – Now what?

Like all the amazing tools offered by Microsoft Excel, number formats are a whole toolkit in itself.

There’s so much to explore, and this article only gives you an idea of how you can come up with different visual representations of the same value.

Not only that, but if you fail to find the format you’re looking for – you can customize one for yourself. That’s where the possibilities become limitless.

Want to learn further? Learn the core functions of Excel including the VLOOKUP, SUMIF, and IF functions.

You need not go any further to master these functions. Click here to sign up for my free 30-minute email course that will take you through these and many more functions in no time.

Kasper Langmann2023-01-19T12:13:39+00:00

Page load link

If you used Excel in any shape or form, there is a pretty good chance that you’ve used the formatting and number formatting features. Formatting options like number, currency, percentage, date and time values are easily accessible to users. However, that’s not all there is in the world of text and number formatting. Going down the rabbit hole, custom formatting can help you fully configure Excel’s built-in settings for formatting.

The main advantage of this approach is that you can alter the look of your data without changing the actual values. This means that you do not need to use additional spaces or formulas to create the layout you want and preserve the raw data.

If you want to modify your data anyways, or need to change a value inside a formula, you can use the TEXT function with all custom formatting syntax we are going to cover in this article. It should be noted that the TEXT function returns a text, and the return value cannot be used in mathematical calculations. If you do, you will receive a #VALUE! error. In this article we’re going to be using a workbook template. You can download it below.

How to create a custom number format in Excel

  1. Select the cell to be formatted and press Ctrl+1 to open the Format Cells dialog. An alternative way to do is by right-clicking the cell and then going to Format Cells > Number Tab.
  2. Under Category, select Custom.
  3. Type in the format code into the Type
  4. Click OK to save your changes.

Note: In Format Cells dialog you can modify the built-in format codes by selecting the format you want to modify in its own category (i.e. Currency > ($1,234.10)) and then selecting Custom Category. Don’t worry, Excel will not let you delete built-in formats.

Number Formatting in Excel - All You Need to Know

Basics

Syntax

The format code has 4 sections separated by semicolons.

POSITIVE; NEGATIVE; ZERO; TEXT

These sections are optional,

  • If a code contains only 1 section, the format is applied to all number types — positive, negative and zero.
  • If a code contains 2 sections, the first section is used for positive and zero values, while the second section is applied to negative values.
  • If a code contains 3 sections, the first is for positive, the second is for negative, and the third is for zero.
  • A code only affects text values if all sections exist.

Default format type in Excel is called General. You can type General for sections you don’t want formatted. Make sure you use a minus sign (-) with General if you want to skip negative values.

If you want to completely hide a type, leave it blank after the semicolon. For example; to hide 0 values, General;-General;;General

Placeholders and the Cheat Sheet

Placeholder Description Raw Value Format Code Formatted Value
General Default format 1234.567 General 1234.567
# Placeholder for digits (numbers) and does not add any leading zeroes. 1234.567 #####.#### 1234.567
0 Placeholder for digits (numbers) and add any leading zeroes. 1234.567 00000.0000 01234.5670
? Placeholder for digits (numbers) and add space characters. 1234.567 ?????.????  1234.567
. Placeholder for the decimal place. 1234.567 0.00 1234.57
_ Adds a blank space, to the width of the following character. You can use in combination with parentheses to add left and right indents, _( and _) respectively. 99 _(#_);(#)  99
-25 (25)
58  58
12  12
-71 (71)
36  36
* Repeats the character after asterisk until the width of the cell is filled. 66 0 *! 66 !!!!!!!!!!!!!!!
Full Name @ *_ Full Name ____
% Convert value to a percentage with % sign 0.12 % 12%
, Thousands separator 1234.567 #, 1
12345678 #, 12,346
12345678 #,###, 12,346
12345678 #,, 12
E Scientific notation format. Requires a ‘+’ symbol after, and a digit placeholder before and after. 1234.567 0.00E+00 1.23E+03
/ Represents fractions 1.234 # ##/## 1 11/47
1.234 # 000/000 1 117/500
1.234 ##/## 58/47
«» Text placeholder for multiple characters 1234.567 #,##0 «km/h» 1,235 km/h
Good «Result is: «@ Result is: Good
Text placeholder for single character 1234 #.00, K 1.23 K
1234567 #.00,, M 1.23 M
@ Placeholder for text Bad «Result is: «@ Result is: Bad
[color] Change Color of value. Options: [Black], [Green], [White], [Blue], [Magenta], [Yellow], [Cyan], [Red] 1234.567 [Green]#,##0.00_);
[Red](#,##0.00);
[Blue]0.00_);
[Magenta]@
1,234.57
-1234.567 (1,234.57)
0 0.00
This is a text This is a text

Common Practices

Display and control of the first digit and decimals

Decimal places in the code are indicated with a period (.). Number of zeroes after the period (.) define the number of decimal places. For example,

  • 0 — display 1 decimal place
  • 00 — display 2 decimal places

If the number has more decimals than the decimal placeholders defined, the number will be rounded to the nearest number of placeholders.

Raw Value Format Code Formatted Value
123.4 0.0 123.4
123.4 0.00 123.40
123.45 0.00 123.45
123.45 0.00 123.46
123.456 0.0 123.5

Alternatively, hash (#) and question mark (?) symbols can be used as decimal places. However, because any missing decimal places will be filled with zeroes, using zeroes instead will be easier to read.

Raw Value Format Code Formatted Value
0.25 0.00 0.25
0.25 #.## .25
123 0.00 123.0
123 #.?? 123.00
123 #.## 123.

Add text to numbers

Custom text can be added to the beginning or the end of a value. Text and characters should be added inside quotes («») and backslashes (). You can use backslash () to add single character.

Raw Value Format Code Formatted Value
123.4 0.0 «ft.» 123.4 ft.
123.4 0.00 l 123.40 l
123.45 «Approx.» 0 Approx. 123
123.45 «Result:» 0.00 C Result: 123.46 C
Bad «Result is: «@ Result is: Bad

Quotation marks or backslashes are not necessary for spaces ( ) and some special characters.

Symbol Description
+ and — Plus and minus signs
( ) Left and right parenthesis
: Colon
^ Caret
Apostrophe
{ } Curly brackets
< > Less-than and greater than signs
= Equal sign
/ Forward slash
! Exclamation point
& Ampersand
~ Tilde
Space character

Below are some special characters you can use by copying or typing in the numerical code while pressing down Alt button.

Symbol Code Description
Alt+0153 Trademark
© Alt+0169 Copyright symbol
° Alt+0176 Degree symbol
± Alt+0177 Plus-Minus sign
µ Alt+0181 Micro sign

Hide value

If you leave any number of sections blank, the value of those sections will be hidden. A section should always be separated (defined) by a semicolon (;). Here are some examples,

Raw Value Format Code Formatted Value
1 0;;0; 1
-2 0;;0;
0 0;;0; 0
Some text 0;;0;
1 ;(0);;@
-2 ;(0);;@ (2)
0 ;(0);;@
Some text ;(0);;@ Some Text
1 ;;;
-2 ;;;
0 ;;;
Some text ;;;

Replace zeroes with dashes

Zeroes can make data tables look more complicated than they actually are. You can hide them completely by using the previous method, or replace them with any character of your choice. Dash (-) is a common example. All you need to is place a dash into the ‘Zero section’.

Raw Value Format Code Formatted Value
0 General;-General;»-«;General
3487 General;-General;»-«;»-«
12 #,##0.00;(#,##0.00);»-«;

Start with zeroes

If try to enter a ZIP number that starts with 0, the leading zeroes will be removed automatically by Excel. To keep the leading zeros, use zero (0) placeholder for whole numbers.

Raw Value Format Code Formatted Value
10010 00000 10010
3487 00000 03487
12 00000 00012
0 00000 00000
123456 00000 123456

Dealing with thousands, millions, and more

You may have noticed that ‘0.0’ or other simple formats do not separate thousands or millions. Adding a comma into the code will insert commas to separate numbers.

Raw Value Format Code Formatted Value
1234 #,##0 1,234
123456 #,##0 123,456
12345678 #,##0 12,345,678
123456.789 #,##0 123,457
123456.789 #,##0.0 123,456.8

There must be placeholders for numbers smaller than one thousand, otherwise such values will be hidden. This behavior allows us to round and format our value to show only thousands or millions.

Raw Value Format Code Formatted Value
1234 #, 1
123456 #, 123
12345678 #, 12345
12345678 #,, 12
123456 #.0, K 123.5 K
12345678 #.0,, M 12.3 M

Display numbers as phone numbers

Phone numbers can be hard to read without any separators. Custom Number Format Codes is perfect for this job. The hash (#) character should be your best bet to avoid any redundancy of placeholders (0, ?)

Raw Value Format Code Formatted Value
1234567890 (###) ###-#### (123) 456-7890
12345678900 (###) #### #### (123) 4567 8900
1234567890 (##) #### #### (12) 3456 7890

Showing Month and Weekday Names

Date and time values are stored as numbers in Excel. When you enter a date, Excel automatically converts it into a numerical value, and then formats the cell.

Before jumping into the code, let’s review some basics. Formatting code has special placeholders for date and time formatting that behave a bit differently. For example, while m and mm will show month as a number, mmm and mmmm will show as a text string. Below are some examples.

Raw Value Format Code Formatted Value
4/1/2018 m 4
4/1/2018 mm 04
4/1/2018 mmm Apr
4/1/2018 mmmm April
4/1/2018 mmmmm A
4/1/2018 d 1
4/1/2018 dd 01
4/1/2018 ddd Sun
4/1/2018 dddd Sunday
4/1/2018  11:59:31 PM dddd, mmmm dd, yyyy h:mm AM/PM;@ Sunday, April 01, 2018 11:59 PM

Here is the full list of options for the date 4/1/2018 23:59:31 ,

Format Code Description Example (4/1/2018 23:59:31)
yyyy Displays the year as a four-digit number. 2018
yy Displays the year as a two-digit number. 18
m Displays the month as a number without a leading zero. 4
mm Displays the month with a leading zero. 04
mmm Displays the month as text, as an abbreviation. Apr
mmmm Displays the month as text. April
mmmmm Displays the month as a single character A
d Displays the day as a number, without a leading zero. 1
dd Displays the day as a number, with a leading zero. 01
ddd Displays the day as a day of the week, as an abbreviation. Sun
dddd Displays the day as a day of the week, without abbreviation Sunday
h Displays the hour without a leading zero. 23
hh Displays the hour with a leading zero. 23
[h] Displays elapsed time in hours (to be used when the time value exceeds 24 hours). 1036607
m Displays the minute without a leading zero. 4
mm Displays the minute with a leading zero. 04
[m] Displays elapsed time in minutes (to be used when the time value exceeds 60 minutes). 62196479
s Displays the second without a leading zero. 31
ss with a leading zero. 31
[s] Displays elapsed time in seconds (to be used when the time value exceeds 60 seconds). 3731788771
AM/PM Converts to 12-hour time. Displays either AM/am/A/a or PM/pm/P/p depending on the time of day. PM
am/pm pm
A/P P
a/p p

Come in Colors Everywhere

Number Formatting can be used color sections of a code. A common example is using the color red for negative numbers. Color code must be placed inside square brackets (i.e. [color]), and entered at the beginning of a section. Here are some available colors,

  • [Black]
  • [Blue]
  • [Cyan]
  • [Green]
  • [Magenta]
  • [Red]
  • [White]
  • [Yellow]
Raw Value Format Code Formatted Value
1234.567 [Green]#,##0.00_);[Red](#,##0.00);[Blue]0.00);[Magenta]@ 1,234.57
-1234.567 (1,234.57)
0 0.00
This is a text This is a text

Conditions

Although Excel has conditional formatting menu, basic conditions can be applied through code. Condition should be placed inside square brackets (i.e. [condition]) just like colors. Conditions are similar to the conditions in some functions (i.e. SUMIF). First add a logical operator, and then a value. For example, “[>=1000000]” means “if value of cell is greater than or equal to 1,000,000 apply the following format”. Conditions should come before the actual code, again, just like with colors. If you want to a color as well, the color code should come first.

Another important thing to note here is, that section structure changes from Positive, Negative, Zero, Text to First Condition, Second Condition (if exists), if previous conditions are not applied. There should be at least two sections for conditions.

If you enter only one condition code and then save the format, Excel will automatically add the second section with «;General». This means that if the condition is not met, General format will be used.

Raw Value Format Code Formatted Value
1234567890 [>=1000000]#,##0,,»M»;[>=1000]#,##0,»K»;0 1,235M
12345 12K
1 [=1]0″ apple»;0″ apples» 1 apple
10 10 apples
25 [Green][>=85]»PASSED»;[Blue][>=60]»RE-CHECK»;[Red]»FAILED» FAILED
72 RE-CHECK
91 PASSED

Introduction

Number formats control how numbers are displayed in Excel. The key benefit of number formats is that they change how a number looks without changing any data. They are a great way to save time in Excel because they perform a huge amount of formatting automatically. As a bonus, they make worksheets look more consistent and professional.

Video: What is a number format

What can you do with custom number formats?

Custom number formats can control the display of numbers, dates, times, fractions, percentages, and other numeric values. Using custom formats, you can do things like format dates to show month names only, format large numbers in millions or thousands, and display negative numbers in red.

Sample custom number formats

Where can you use custom number formats?

Many areas in Excel support number formats. You can use them in tables, charts, pivot tables, formulas, and directly on the worksheet.

  • Worksheet — format cells dialog
  • Pivot Tables — via value field settings
  • Charts — data labels and axis options
  • Formulas — via the TEXT function

What is a number format?

A number format is a special code to control how a value is displayed in Excel. For example, the table below shows 7 different number formats applied to the same date, January 1, 2019:

Input Code Result
1-Jan-2019 yyyy 2019
1-Jan-2019 yy 19
1-Jan-2019 mmm Jan
1-Jan-2019 mmmm January
1-Jan-2019 d 1
1-Jan-2019 ddd Tue
1-Jan-2019 dddd Tuesday

The key thing to understand is that number formats change the way numeric values are displayed, but they do not change the actual values.

Where can you find number formats?

On the home tab of the ribbon, you’ll find a menu of build-in number formats. Below this menu to the right, there is a small button to access all number formats, including custom formats:

Number format menu on Home tab of Ribbon

This button opens the Format Cells dialog box. You’ll find a complete list of number formats, organized by category, on the Number tab:

Format Cells dialog box on Number tab

Note: you can open Format Cells dialog box with the keyboard shortcut Control + 1.

General is default

By default, cells start with the General format applied. The display of numbers using the General number format is somewhat «fluid». Excel will display as many decimal places as space allows, and will round decimals and use scientific number format when space is limited. The screen below shows the same values in column B and D, but D is narrower and Excel makes adjustments on the fly.

General number format in narrow column

How to change number formats

You can select standard number formats (General, Number, Currency, Accounting, Short Date, Long Date, Time, Percentage, Fraction, Scientific, Text) on the home tab of the ribbon using the Number Format menu.

Note: As you enter data, Excel will sometimes change number formats automatically. For example if you enter a valid date, Excel will change to «Date» format. If you enter a percentage like 5%, Excel will change to Percentage, and so on.

Shortcuts for number formats

Excel provides a number of keyboard shortcuts for some common formats:

Format Shortcut
General format Ctrl Shift ~
Currency format Ctrl Shift $
Percentage format Ctrl Shift %
Scientific format Ctrl Shift ^
Date format Ctrl Shift #
Time format Ctrl Shift @
Custom formats Control + 1

See also: 222 Excel Shortcuts for Windows and Mac

Where to enter custom formats

At the bottom of the predefined formats, you’ll see a category called custom. The Custom category shows a list of codes you can use for custom number formats, along with an input area to enter codes manually in various combinations.

Custom category in format cells dialog box

When you select a code from the list, you’ll see it appear in the Type input box. Here you can modify existing custom code, or to enter your own codes from scratch. Excel will show a small preview of the code applied to the first selected value above the input area.

Note: Custom number formats live in a workbook, not in Excel generally. If you copy a value formatted with a custom format from one workbook to another, the custom number format will be transferred into the workbook along with the value.

How to create a custom number format

To create custom number format follow this simple 4-step process:

  1. Select cell(s) with values you want to format
  2. Control + 1 > Numbers > Custom
  3. Enter codes and watch preview area to see result
  4. Press OK to save and apply 

Tip: if you want base your custom format on an existing format, first apply the base format, then click the «Custom» category and edit codes as you like.

How to edit a custom number format

You can’t really edit a custom number format per se. When you change an existing custom number format, a new format is created and will appear in the list in the Custom category. You can use the Delete button to delete custom formats you no longer need.

Warning: there is no «undo» after deleting a custom number format!

Structure and Reference

Excel custom number formats have a specific structure. Each number format can have up to four sections, separated with semi-colons as follows:

Custom number format structure

This structure can make custom number formats look overwhelmingly complex. To read a custom number format, learn to spot the semi-colons and mentally parse the code into these sections:

  1. Positive values
  2. Negative values
  3. Zero values
  4. Text values

Not all sections required

Although a number format can include up to four sections, only one section is required. By default, the first section applies to positive numbers, the second section applies to negative numbers, the third section applies to zero values, and the fourth section applies to text.

  • When only one format is provided, Excel will use that format for all values.
  • If you provide a number format with just two sections, the first section is used for positive numbers and zeros, and the second section is used for negative numbers.
  • To skip a section, include a semi-colon in the proper location, but don’t specify a format code.

Characters that display natively

Some characters appear normally in a number format, while others require special handling. The following characters can be used without any special handling:

Character Comment
$ Dollar
+- Plus, minus
() Parentheses
{} Curly braces
<> Less than, greater than
= Equal
: Colon
^ Caret
Apostrophe
/ Forward slash
! Exclamation point
& Ampersand
~ Tilde
  Space character

Escaping characters

Some characters won’t work correctly in a custom number format without being escaped. For example, the asterisk (*), hash (#), and percent (%) characters can’t be used directly in a custom number format – they won’t appear in the result. The escape character in custom number formats is the backslash (). By placing the backslash before the character, you can use them in custom number formats:

Value Code Result
100 #0 #100
100 *0 *100
100 %0 %100

Placeholders

Certain characters have special meaning in custom number format codes. The following characters are key building blocks:

Character Purpose
0 Display insignificant zeros
# Display significant digits
? Display aligned decimals
. Decimal point
, Thousands separator
* Repeat following character
_ Add space
@ Placeholder for text

Zero (0) is used to force the display of insignificant zeros when a number has fewer digits than zeros in the format. For example, the custom format 0.00 will display zero as 0.00, 1.1 as 1.10 and .5 as 0.50.

Zero placeholder examples

Pound sign (#) is a placeholder for optional digits. When a number has fewer digits than # symbols in the format, nothing will be displayed. For example, the custom format #.## will display 1.15 as 1.15 and 1.1 as 1.1.

Pound placeholder examples

Question mark (?) is used to align digits. When a question mark occupies a place not needed in a number, a space will be added to maintain visual alignment. 

Question mark placeholder examples

Period (.) is a placeholder for the decimal point in a number. When a period is used in a custom number format, it will always be displayed, regardless of whether the number contains decimal values.

Comma (,) is a placeholder for the thousands separators in the number being displayed.  It can be used to define the behavior of digits in relation to the thousands or millions digits.

Comma placeholder examples

Asterisk (*) is used to repeat characters. The character immediately following an asterisk will be repeated to fill remaining space in a cell.

Asterisk placeholder examples

Underscore (_) is used to add space in a number format. The character immediately following an underscore character controls how much space to add. A common use of the underscore character is to add space to align positive and negative values when a number format is adding parentheses to negative numbers only. For example, the number format «0_);(0)» is adding a bit of space to the right of positive numbers so that they stay aligned with negative numbers, which are enclosed in parentheses.

Underscore placeholder examples

At (@) — placeholder for text. For example, the following number format will display text values in blue:

0;0;0;[Blue]@

See below for more information about using color.

Automatic rounding

It’s important to understand that Excel will perform «visual rounding» with all custom number formats. When a number has more digits than placeholders on the right side of the decimal point, the number is rounded to the number of placeholders. When a number has more digits than placeholders on the left side of the decimal point, extra digits are displayed. This is a visual effect only; actual values are not modified.

Number formats for TEXT

To display both text along with numbers, enclose the text in double quotes («»).  You can use this  approach to append or prepend text strings in a custom number format, as shown in the table below.

Value Code Result
10 General» units» 10 units
10 0.0″ units» 10.0 units
5.5 0.0″ feet» 5.5 feet
30000 0″ feet» 30000 feet
95.2 «Score: «0.0 Score: 95.2
1-Jun «Date: «mmmm d Date: June 1

Number formats for DATES

Dates in Excel are just numbers, so you can use custom number formats to change the way they display. Excel has many specific codes you can use to display components of a date in different ways. The screen below shows how Excel displays the date in D5, September 3, 2018, with a variety of custom number formats:

Number format codes for dates

Number formats for TIME

Times in Excel are fractional parts of a day. For example, 12:00 PM is 0.5, and 6:00 PM is 0.75. You can use the following codes in custom time formats to display components of a time in different ways. The screen below shows how Excel displays the time in D5, 9:35:07 AM, with a variety of custom number formats:

Number format codes for times

Note: m and mm can’t be used alone in a custom number format since they conflict with the month number code in date format codes.

Number formats for ELAPSED TIME

Elapsed time is a special case and needs special handling. By using square brackets, Excel provides a special way to display elapsed hours, minutes, and seconds. The following screen shows how Excel displays elapsed time based on the value in D5, which represents 1.25 days:

Number format codes for elapsed time

Number formats for COLORS

Excel provides basic support for colors in custom number formats. The following 8 colors can be specified by name in a number format: [black] [white] [red][green] [blue] [yellow] [magenta] [cyan]. Color names must appear in brackets.

Custom number format with colors

Colors by index

In addition to color names, it’s also possible to specify colors by an index number (Color1,Color2,Color3, etc.) The examples below are using the custom number format: [ColorX]0″▲▼», where X is a number between 1-56:

[Color1]0"▲▼" // black
[Color2]0"▲▼" // white
[Color3]0"▲▼" // red
[Color4]0"▲▼" // green
etc.

The triangle symbols have been added only to make the colors easier to see. The first image shows all 56 colors on a standard white background. The second image shows the same colors on a gray background. Note the first 8 colors shown correspond to the named color list above.

Custom number format colors on white

Custom number format colors on gray background

Apply number formats in a formula

Although most number formats are applied directly to cells in a worksheet, you can also apply number formats inside a formula with the TEXT function. For example, with a valid date in A1, the following formula will display the month name only:

=TEXT(A1,"mmmm")

The result of the TEXT function is always text, so you are free to concatenate the result of TEXT to other strings:

="The contract expires in "&TEXT(A1,"mmmm")

The screen below shows the number formats in column C being applied to numbers in column B using the TEXT function:

Applying number formats with the TEXT function

One quirk of the TEXT function relates to double quotes («») that are part of certain custom number formats. Because the format_text is entered as a text string, Excel won’t allow you to enter the formula without removing the quotes or adding more quotes. For example, to display a large number in thousands, you can use a custom number format like this:

0, "k"

Notice k appears in quotes («k»). To apply the same format with the TEXT function, you can use simply:

=TEXT(A1,"0, k")

Notice the k is not surrounded by quotes. Alternately, you can add extra double quotes as below, which returns the same result:

=TEXT(A1,"0,""K""")

This behavior only occurs when you are hardcoding a format inside TEXT. If you are applying a format entered elsewhere on the worksheet (as in cells C6 and C9 in the worksheet above) you can use a standard number format.

Measurements

You can use a custom number format to display numbers with an inches mark («) or a feet mark (‘). In the screen below, the number formats used for inches and feet are:

0.00 ' // feet
0.00 " // inches

Number formats for feet and inches

These results are simplistic, and can’t be combined in a single number format. You can however use a formula to display feet together with inches.

Conditionals

Custom number formats also up to two conditions, which are written in square brackets like [>100] or [<=100]. When you use conditionals in custom number formats, you override the standard [positive];[negative];[zero];[text] structure. For example, to display values below 100 in red, you can use:

[Red][<100]0;0

To display values greater than or equal to 100 in blue, you can extend the format like this:

[Red][<100]0;[Blue][>=100]0

Conditions with custom number formats

To apply more than two conditions, or to change other cell attributes, like fill color, etc. you’ll need to switch to Conditional Formatting, which can apply formatting with much more power and flexibility using formulas.

Plural text labels

You can use conditionals to add an «s» to labels greater than zero with a custom format like this:

[=1]0″ day»;0″ days»

Custom number format for plural text

Telephone numbers

Custom number formats can also be used for telephone numbers, as shown in the screen below:

Custom number format for telephone numbers

Notice the third and fourth examples use a conditional format to check for numbers that contain an area code. If you have data that contains phone numbers with hard-coded punctuation (parentheses, hyphens, etc.) you will need to clean the telephone numbers first so that they only contain numbers.

Hide all content

You can actually use a custom number format to hide all content in a cell. The code is simply three semi-colons and nothing else ;;;

To reveal the content again, you can use the keyboard shortcut Control + Shift + ~, which applies the General format.

Other resources

  • Developer Bryan Braun built a nice interactive tool for building custom number formats

Excel Custom Number formatting is the clothing for data in excel cells. You can dress these the way you want. All you need is a bit of know-how of how Excel Custom Number Format works.

With custom number formatting in Excel, you can change the way the values in the cells show up, but at the same time keeping the original value intact.

For example, I can make a date value show up in different Date formats, while the underlying value (the number that represents the date) would remain the same.

In this tutorial, I will cover everything about custom number format in Excel, and also show you some really useful examples that you can use in your day-to-day work.

So let’s get started!

Excel Custom Number Format Construct

Before I show you the awesomeness of it, let me briefly explain how custom number formatting works in Excel.

By design, Excel can accept the following four types of data in a cell:

  • A positive number
  • a negative number
  • 0
  • Text strings (this can include pure text strings as well as alphanumeric strings)

Another data type that Excel can accept is dates, but since all date and time values are stored as numbers in Excel, these would be covered as a part of the positive number.

For any cell in a worksheet in Excel, you can specify how each of these data types should be shown in the cell.

And below is the syntax in which you can specify this format.

<Format for POSITIVE Numer>;<Format for NEGATIVE Numer>;<Format for ZERO>;<Format for TEXT>

Note that all these are separated by semi-colons (;).

Anything that you enter in a cell in Excel would fall in either of these four categories and hence a custom format for it can be specified.

If you mention only:

  • One format: It is applied to all four sections. For example, if you just write General, it will be applied for all four sections.
  • Two formats: The first one is applied to positive numbers and zeros, and the second one is applied to negative numbers. Text format by default becomes General.
  • Three Formats: The first one is applied to positive numbers, the second one is applied to negative numbers, the third is applied to zero, and the text disappears as nothing is specified for text.

If you want to learn more about custom number formatting, I would highly recommend the Office Help section.

How this works and where to enter these formats are covered later in this tutorial. For now, just keep in mind that this is the syntax for the format for any cell

How Custom Number Format Works in Excel

Then you open a new Excel workbook, by default all the cells in all the worksheets in that workbook have the General format where:

  • Positive numbers are shown as is (aligned to the left)
  • Negative numbers are shown with a minus sign (and aligned to the left)
  • Zero is shown as 0 (and aligned to the left)
  • Text is shown as is (aligned to the right)

And in case you enter a date, it’s shown based on your regional setting (in DD-MM-YYYY or MM-DD-YYYY format).

So by default, the cell’s number formatting is:

General;General;General;General

Where each data type is formatted as General (and follow the rules I mentioned above, based on whether it’s a positive number, negative number, 0, or text)

Now the default setting is alright, but how do you change the format. For example, if I want my negative numbers to show up in red color or I want my dates to show up in a specific format then how do I do that.

Using the Format Drop Down in the Ribbon

You can find some of the commonly used number formats in the Home tab within the Number group.

It’s a drop-down that shows many of the commonly used formats that you can apply to a cell by simply selecting the cell and then selecting the format from this list.

Existing formats in Excel ribbon

For example, if you want to convert numbers into percentages or converted dates into short date format or long-form date format, then you can easily do it by using the options in the dropdown.

Using Format Cells Dialog Box

Format cells dialog boxes where you get the maximum flexibility when it comes to applying formats to a cell in Excel.

It already has a lot of premade formats that you can use, or if you want to create your own custom number format, then you can do that as well.

Here is how to open the Format Cells dialog box;

  1. Click the Home TabClick the Home tab
  2. In the Number group, click on the dialog box launcher icon (the small tilted arrow at the bottom-right of the group).Format cells dialog box launcher

This will open the Format Cells dialog box. Within it, you will find all the formats in the Number tab (along with the option to create Custom cell formats)

You can also use the following keyboard shortcut to open the format cells dialog box:

CONTROL + 1 (all the Control key and then press the 1 key).

In case you’re using Mac, you can use CMD + 1

Now let’s have a couple of practical examples where we will create our own custom number formats.

Examples of Using Custom Number Formatting in Excel

Now let’s have a couple of practical examples where we will create our own custom number formats.

Hide a Cell Value (or Hide All values in a Range of Cells)

Sometimes, you may have a need to hide the content of the cell (without hiding the row or column that has the cell).

A practical case of this is when you are creating an Excel dashboard and there are a couple of values that you use in the dashboard but you do not want the users to see it. so you can simply hide these values

Suppose you have a dataset as shown below and you want to hide all the numeric values:

Dataset to hide values

Here is how to do this using custom formatting in Excel:

  1. Select the cell or the range of cells for which you want to hide the cell content
  2. Open the Format Cells dialog box (keyboard shortcut Control + 1)
  3. In the Number tab, click on the Custom
  4. Enter the following format in the Type field:
    ;;;

Three semicolons to hide all the cell values

How does this work?

The format for four different types of data types is divided by semicolons in the following format:

<Format for POSITIVE Numer>;<Format for NEGATIVE Numer>;<Format for ZERO>;<Format for TEXT>

In this technique, we have removed the format and only specified the semicolon, which indicates that we do not want any formatting for the cells. This is an indication for Excel to hide any content that is there in the cell.

Note that while this hides the content of the cell, it’s still there. so if you have numbers that you have hidden, you can still use these in calculations (which makes this a great trick for Excel dashboards and reports).

Display Negative Numbers in Red Color

By default, negative numbers show up with a minus sign (or within parenthesis in some regional settings).

You can use custom number formatting to change the color of the negative numbers and make them show up in red color.

Suppose you have a dataset as shown below and you want to highlight all the negative values in red color.

Dataset to hilight negative values in red

Below are the steps to do this:

  1. Select the range of cells where you want to show negative numbers in red
  2. Open the Format Cells dialog box (keyboard shortcut Control + 1)
  3. In the Number tab, click on the Custom
  4. Enter the following format in the Type field:
General;[Red]-General

Format to color negative values in red

The above format will make your cells with negative values show in red color.

Negative values highlighted as red

How does this work?

When you only specify two formats as the custom number format, the first one is considered for positive numbers and 0, and the second one is considered for negative numbers (the next value by default becomes the general format).

In the above format that we have used, we have specified the color that we want that format to take up in the square brackets.

So while the negative numbers take the general format, they are shown in red color with a minus sign.

In case you want to make the negative numbers stop in red color within parenthesis (instead of the minus sign), you can use the below format:

General;[Red](General)

Negative numbers in parenthesis

Also read: Show Negative Numbers in Parentheses (Brackets) in Excel (Easy Ways)

Add text to Numbers (such as Millions/Billions)

One amazing thing about custom number formatting is that you can add a prefix or a suffix text to a number, while still keeping the original number in the cell.

For example, I can have ‘100’ show up as ‘$100 Million’, while still having the original value in the cell so that I can use it in calculations.

Excel Custom Number Format - Numbers as Text

Suppose you have a dataset as shown below and you want to show these numbers with a dollar sign and the word million in front of it.

Dataset to show values in millions

Below are the steps to do this:

  1. Select the dataset where you want to add the text to the numbers
  2. Open the Format Cells dialog box (keyboard shortcut Control + 1)
  3. In the Number tab, click on the Custom
  4. Enter the following format in the Type field:
$General "Million"

Format to show numbers with dollar and million

Note that this custom number format will only affect numbers. If you enter text in the same cell, it would appear as it is.

How does this work?

In this example, to the general format, I have added the word million in double-quotes. anything that I add in double-quotes to the format is shown as is in the cell.

I also added the dollar sign before the general format so that all my numbers also show the dollar sign before the number.

Note: If you’re wondering why the dollar sign is not in double-quotes while the word Million is in double-quotes, it’s because Excel recognizes dollar as a symbol that is often used in custom number formatting, and doesn’t require you to add double quotes to it. You can go ahead and add double quotes to the dollar sign, but when you close the format cells dialog box and open it again, you will notice that Excel has removed it

Disguise Numbers and Text

With custom number formatting, you can assess a maximum of two conditions, and based on these conditions you can apply a format to the cell.

For example, suppose you have a list of scores for some students, you want to show the text Pass or Fail based on the score (where any score less than 35 should show ‘Fail’, else it should show ‘Pass’.

Score that needs to be converted into text

Below are the steps to show scores as Pass or Fail instead of the value using custom number format:

  1. Select the dataset where you have the scores
  2. Open the Format Cells dialog box (keyboard shortcut Control + 1)
  3. In the Number tab, click on the Custom
  4. Enter the following format in the Type field:
    [<35]"Fail";"Pass"

Custom formatting to show numbers as Text

Below is how your data would look after you have applied the above format.

Resulting scores that show pass and fail

Note that it does not change the value in the cells. The cell continues to have the scores in numeric values while displaying ‘Pass’ or ‘Fail’ depending on the cell value.

How does this work?

In this example, the condition needs to be specified within the square brackets. custom number formatting then evaluates the value in the cell and applies the format accordingly.

So if the value in the cell is less than 35, then the number is hidden, and instead the text ‘Fail’ is shown, adding all other cases, ‘Pass’ is shown.

Similarly, if you want to convert a range of cells that have 0’s and 1’s into TRUEs and FALSEs, you can use the below format:

[=0]"FALSE";[=1]"TRUE"

Remember that you can only use two conditions in custom number formatting. If you try and use more than two conditions, it is going to so your prompt letting you know that it cannot accept that format.

Hide Text but Display Numbers

Sometimes, when you download your data from databases since there are empty are filled with value such as Not Available or NA or –

With custom number formatting, you can hide all the text values while keeping the numbers as is. this also ensures that your original data is intact (as you are not deleting the text value, you’re just simply hiding it)

Excel Custom Number Format Hide Text

Suppose you have a data set as shown below where you want to hide all the text values:

KPI Data with text values

Below are the steps to do this:

  1. Select the dataset where you have the data
  2. Open the Format Cells dialog box (keyboard shortcut Control + 1)
  3. In the Number tab, click on the Custom
  4. Enter the following format in the Type field:
General; -General; General;

Formatting to hide all text values

Note that I have used the General format for numbers. You can any format you wish (such as 0, 0.#, #0.0%). Also, note that there is a negative sign (-) before the second General format, as it represents the format for negative numbers.

How does this work?

In this example, since we wanted to hide all the text values, we simply didn’t specify the format for it.

And since we specified the format for the other three data types (positive number, negative number, and zero), Excel understood that we have purposefully left the format for the text value empty, and it should not show anything if a cell has a text string.

Display Numbers as Percentages (%)

With custom number formatting, you can also change the numbers and make them show up in percentages.

Excel Custom Number Format number as percentage

Suppose you have a data set as shown below, and you want to convert these numbers to show the equivalent percentage value:

Data that needs to be converted to percentage

Below are the steps to do this:

  1. Select the cells where you have the numbers (that you want to convert to percentage)
  2. Open the Format Cells dialog box (keyboard shortcut Control + 1)
  3. In the Number tab, click on the Custom
  4. Enter the following format in the Type field:
0%

Formatting to show numbers in percentage

This will change the numbers to their percentages. For example, it changes from 0.11 to 11%.

If all you want to do is converted a number into its equivalent percentage value, a better way to do this would be to use the percentage option in the format cells dialog box.

Where custom formatting can be useful is when you want more control over how you want to show the percentage value.

For example, if you want to show some additional text with the percentage, all you want to show negative percentages in red color then it is better to use custom formatting

Also read: How to Change Date Format In Excel?

Display Numbers in a Different Unit (Millions as Billions or Grams as Kilograms)

If you work with large numbers, you may want to show these in a different unit. for example, if you have the sales data of some companies, you may want to show the sales in millions or billions (while still keeping the original sale value in the cells)

Thankfully, you can easily do that with custom number formatting.

Suppose you have a data set as shown below, and you want to show these sales values in millions.

Data where numbers need to be converted into millions

Below are the steps to do this:

  1. Select the cells where you have the numbers
  2. Open the Format Cells dialog box (keyboard shortcut Control + 1)
  3. In the Number tab, click on the Custom
  4. Enter the following format in the Type field:
0.0,,

Custom format to show numbers in millions

The above would give you the result as shown below (values in millions in one digit after the decimal):

Resulting data where numbers are in millions

How does this work?

In the above format, a zero before the decimal indicates that Excel should show the entire number (exactly as it is in the cell), and a 0 after the decimal indicates that it should show only one significant digit after the decimal point.

So 0.0 would always be a number with one digit after the decimal point.

When you add a comma after the 0.0, it will shave off the last three-digit of the number. For example, 123456 would become 123.4 (the last three digits are removed, and since it has to show 1 digit after the decimal point, it shows 4)

If you think about it, it’s similar to dividing the number by 1000. So if you want to show a number in the ‘millions’ unit, you need to add 2 commas, so that it would shave off the last 6 digits.

And if you also want to show the word million or the alphabet M after the number, use the below format

0.0,, "M"

You May Also Like the Following Excel Tutorials:

  • Disguise Numbers as Text in a Drop Down List in Excel.
  • Color Negative Chart Data Labels in Red with a downward arrow.
  • How to Copy Conditional Formatting to Another Cell in Excel
  • How to Remove Cell Formatting in Excel (from All, Blank, Specific Cells)
  • How to Remove Table Formatting in Excel (Easy Guide)
  • How To Convert Date To Serial Number In Excel?

Like this post? Please share to your friends:
  • Formatting cell colors in excel
  • Format if statement excel
  • Formatting a workbook in excel
  • Format html for excel
  • Format header in excel