Custom number formats in Excel

Excel has many built-in number formats that you can use: Monetary, Fiscal, Date, Time, Percentage, etc. If you can’t find a suitable number format, create your own.

Note from the translator: This article is aimed primarily at the English-speaking user, although it is a translation. This must be taken into account when compiling digital codes for custom number formats. For example, in the English version of Excel, a dot is used to separate the integer and fractional parts, and in the version, a comma; a comma is used to separate groups of digits in the English version, and a space in the Russified version, etc. Don’t forget about it!

Zeros in front

For example, you have codes consisting of 5 digits. Instead of typing 00041, just enter 41, and let Excel fill in the missing zeros.

  1. Enter value 41 into a cell A1.
  2. Highlight a cell A1, right click on it and press Format Cells (cell format).
  3. Выберите Custom (All formats).
  4. Enter the following numeric format code: 00000.
  5. Press OK.

Note: In the sample (Sample) Excel shows how a number will be formatted.

Result:

Custom number formats in Excel

Note: Cell A1 still contains a number 41. We only changed the appearance of this value, not the number itself.

Decimals

You can control the number of decimal places. Enter 0 to display the nearest integer value. Enter 0.0to display one decimal place. For two decimal places use 0.00 etc.

  1. Enter value 839.1274 into a cell A1.
  2. Use the following numeric code for the format: 0.00.Custom number formats in Excel

Add text

In addition, right within the format, you can add text to the number. For example, “ft«.

  1. Enter value 839.1274 into a cell A1.
  2. Use the following numeric code for the number format: 0.0″ ft».Custom number formats in Excel

Note: We just changed the appearance of this number, not the value itself. You, as before, can use this number in your calculations.

Large numbers

You can manage large numbers. Write one comma for thousands and two commas for millions.

  1. Enter values ​​in cells A1, B1, C1 и D1: 1000000, 2500000, 81000000 and 700000.
  2. Use the following numeric code for the format:

    0.0,,» M» – for English localization;

    0,0 » M» – for localization.

    Custom number formats in Excel

Note: We have entered 0.0 to display one decimal place and » M»to add the letter M (millions) with a space after the value itself.

Character repetition

Write an asterisk (*) followed by a character to fill the cell with that character.

  1. Enter “Hi» to cell A1.
  2. Use the following numeric code for the format: @ *-Custom number formats in Excel

Note: Symbol @ used to enter text.

Colours

You can manage positive numbers, negative numbers, zero values ​​and text at the same time. In the number format code, each part is separated by a semicolon (;).

  1. Enter the following values ​​in the cells A1, B1, C1 и A2: 5000000, 0, Hi and -5.89.
  2. Use the following numeric code for the format:

    [Green]$#,##0_);[Red]$(#,##0);»zero»;[Blue]»Text: «@

    [Green]$# ##0_);[Red]$(# ##0);”zero”;[Blue]”Text: “@

    Custom number formats in Excel

Note: Code #,## used to add a comma in large numbers. To add a space, type an underscore “_” followed by a character. The length of the space will be equal to the length of this character. In the example above, we added the parenthesis “)“. As a result, the rightmost zero in the cell A1 located exactly above the negative number in parentheses.

Use two parts separated by a semicolon to manage only positive and negative numbers. Three parts, separated by a semicolon, to control positive and negative numbers, as well as values ​​equal to zero.

Date and Time

You can manage dates and times. Use one of the existing date or time formats as a starting point.

  1. Enter value 41674 into a cell A1.
  2. Highlight a cell A1, right click on it and press Format Cells (cell format).
  3. Select format Data (Date) and in the list Type (Type) – long date format.Custom number formats in Excel

Note: In line sample (Sample) Excel will show you how the number will be formatted.

  1. Click on Custom (All formats).
  2. Slightly change the numeric format code. For example: mm/dd/yyyy, dddd (DD/MM/YYYY, DDDD).
  3. Press OK.Custom number formats in Excel

Result:

Custom number formats in Excel

General note: Custom number formats are stored in the document where they are created. If you copy a value with a custom number format to another workbook, it becomes available in that workbook as well.

Leave a Reply