Sub topic 3
Built-in Number Formats: Decimals, Separators, and Negatives
This chapter covers the Number category of built-in formats. It assumes you can enter data in cells, select ranges, use the Ribbon, and write a basic formula such as =A1+B1. It also assumes you know that a cell's displayed text is separate from its stored value, which an earlier chapter covered.
What the Number category controls
The Number category in Format Cells has three settings:
- Decimal places: how many digits appear after the decimal point (0 to 30).
- Use 1000 Separator: whether groups of three digits are separated, as in 1,234,567.
- Negative numbers: how values below zero are shown.
None of these settings changes the stored value. If A1 holds 1234.5678 and you display two decimals, Excel shows 1,234.57, but a formula referring to A1 still uses 1234.5678.
General is the default
New cells use the General format. General shows as many digits as fit in the column width. It does not add separators. It drops trailing zeros, so 2.50 is shown as 2.5. It switches to scientific notation for very large or very small values, or when the column is too narrow.
General is useful for data entry but poor for reports. Columns of General values have ragged decimals and no alignment on the decimal point. Applying the Number category fixes that.
Applying the Number category
- Select the cells.
- Press Ctrl+1 to open Format Cells.
- On the Number tab, choose Number.
- Set Decimal places, tick Use 1000 Separator (,), and pick a negative style.
These Ribbon buttons and shortcuts work on the Home tab:
| Action | Ribbon | Shortcut |
|---|---|---|
| Number with 2 decimals, separator, minus sign | Number Format list, Number | Ctrl+Shift+1 |
| Comma Style | Comma Style button (the comma icon) | none |
| Add a decimal place | Increase Decimal | none |
| Remove a decimal place | Decrease Decimal | none |
| Back to General | Number Format list, General | Ctrl+Shift+~ |
Increase Decimal and Decrease Decimal change the format by one digit each click. If the selected cells have different formats, they apply the change relative to the first cell in the selection, which can surprise you.
What the dialog writes for you
Every choice in the dialog is stored as a format code. You can see the code by choosing the Custom category after you apply a Number format. With 2 decimals and the separator ticked, the code is:
#,##0.00Here # shows a digit only if one exists, 0 shows a digit and pads with zero, , between digit placeholders turns on the separator, and . marks the decimal point. A later chapter covers these placeholders in detail. For now, the point is that the dialog is a front end for codes, and you can read them.
With 0 decimals and no separator, the code is simply 0. With 3 decimals and the separator, it is #,##0.000.
Negative number styles
The dialog offers four styles for negatives. Each is a two-section code, with the positive format first and the negative format second, separated by a semicolon.
| Style shown in dialog | Code | Example for -1234.5 |
|---|---|---|
| -1234.10 | `#,##0.00` (no second section) | -1,234.50 |
| 1234.10 in red | `#,##0.00;[Red]#,##0.00` | 1,234.50 in red |
| (1234.10) | `#,##0.00_);(#,##0.00)` | (1,234.50) |
| (1234.10) in red | `#,##0.00_);[Red](#,##0.00)` | (1,234.50) in red |
The exact list can differ slightly between Excel versions and regional settings, and some versions show the red options without the minus sign.
The parentheses styles use _) in the positive section. The underscore tells Excel to leave a blank space as wide as the character that follows it, here a closing parenthesis. This keeps positive and negative numbers lined up on the right edge. Without it, positive digits would sit flush right and negative digits would stick out by one character.
#,##0.00_);[Red](#,##0.00)Accountants usually prefer parentheses because a minus sign is easy to miss in a printed column. Red-only styles with no sign are a poor choice for anything that will be printed in black and white, because the sign information disappears.
Comma Style
The Comma Style button applies a different format from the Number category. It is an accounting-style code:
_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)Comma Style differs from the Number category in three ways:
- Negatives appear in parentheses.
- Zero appears as a dash.
- The
*followed by a space repeats spaces to fill the cell, which pushes numbers to the right edge.
Comma Style has no currency symbol. The Accounting format, covered in a later chapter, is the same layout with a symbol added.
Separators depend on your system
In a format code, the comma always means "thousands separator" and the period always means "decimal point". On screen, Excel replaces them with the separators from your Windows or macOS regional settings. On a German system, the code #,##0.00 still works as written, but the cell displays 1.234,57.
This matters in two places:
- A workbook shows different separators on computers with different regional settings. The stored values are identical.
- If you share a workbook, you cannot assume your reader sees the same punctuation you do.
Edge cases
- Negative zero. A value of -0.001 with a format of two decimals displays as -0.00, because the stored value is negative. If this is unwanted, round the value with a formula, or add a conditional section. Rounding is covered in the next chapter.
- Too narrow. If a formatted number is wider than the column, the cell shows
####. Widen the column. Formatting with more decimals or separators makes a number wider. - Display limit versus precision. Excel keeps about 15 significant digits. Formatting a number with 20 decimals shows zeros or noise after the 15th digit, not extra accuracy.
- Mixed formats in a column. Totals add stored values, so a column displayed with 0 decimals can appear to be off by one. For example, 1.4 + 1.4 displays as 1 + 1 = 3 if the total is 2.8 shown with 0 decimals.
Exercise
Cell A1 holds 2.5 and A2 holds 2.5, both formatted with 0 decimal places. A3 contains =A1+A2, also formatted with 0 decimals. What do the three cells display, and what does A3 store?
Show answer
A1 and A2 each display 3 (Excel rounds half up for display), and A3 displays 5. A3 stores 5, which is the sum of the stored values 2.5 + 2.5. The visible numbers 3 + 3 would give 6, so the column looks wrong, but the format only changed how the values look.
Exercise
Write a custom format code that shows positive numbers with a thousands separator and two decimals, and negative numbers in red parentheses, with positive and negative digits lined up on the right.
Show answer
#,##0.00);[Red](#,##0.00) The `)` in the first section reserves space equal to a closing parenthesis, so positive digits align with negative digits.