Sub topic 4
Formatting versus rounding
This chapter assumes you can apply a built-in number format from the Ribbon or the Format Cells dialog. It also assumes you can write a basic formula and know that a cell holds a stored value separate from what it displays. The chapter covers where formatting and rounding differ, what that difference does to your totals and comparisons, and which tool to use for each job.
Display rounding is not value rounding
When you apply a format such as 0.00, Excel rounds the number only for display. The cell keeps its full stored value (up to 15 significant digits). Formulas, charts, and lookups all read the stored value, not the text you see.
0.00Type 19.994 in a cell and apply this format. The cell shows 19.99. The formula bar still shows 19.994.
Rounding in a display format works like this:
- Excel rounds half away from zero, so
2.5formatted with no decimals shows3and-2.5shows-3. - The format never changes the cell's stored value.
- A format with no decimals still keeps the decimals in memory.
Where the gap causes visible errors
Suppose A1 and A2 both contain 19.994, formatted with two decimals. Both cells show 19.99. A reader adds them by hand and expects 39.98.
=A1+A2The formula returns 39.988, which the cell displays as 39.99. The sheet looks wrong, but Excel is adding the stored values correctly.
The same gap breaks comparisons:
=A1=B1If A1 holds 19.994 and B1 holds 19.99, both cells display 19.99, yet this formula returns FALSE. Lookups with exact match fail for the same reason.
Rounding the stored value
The ROUND function changes the stored value. This is the correct tool when the number itself must have fewer decimals, such as an invoice line that is billed in whole cents.
=ROUND(A1,2)If A1 holds 19.994, this returns 19.99. The result is a real 19.99, so a sum of two such cells is 39.98.
ROUND takes a second argument, num_digits:
- A positive number rounds to that many decimal places.
- Zero rounds to a whole number.
- A negative number rounds to the left of the decimal point.
=ROUND(1234.567,-2)This returns 1200.
The rounding family
| Function | What it does | Example | Result |
|---|---|---|---|
| `ROUND(x,n)` | Rounds half away from zero | `=ROUND(2.5,0)` | 3 |
| `ROUNDUP(x,n)` | Rounds away from zero | `=ROUNDUP(2.11,1)` | 2.2 |
| `ROUNDDOWN(x,n)` | Rounds toward zero | `=ROUNDDOWN(2.19,1)` | 2.1 |
| `TRUNC(x,n)` | Cuts off digits, no rounding | `=TRUNC(-2.7)` | -2 |
| `INT(x)` | Rounds down to the next lower integer | `=INT(-2.7)` | -3 |
| `MROUND(x,m)` | Rounds to the nearest multiple of m | `=MROUND(17,5)` | 15 |
TRUNC and INT differ only for negative numbers. TRUNC removes the fraction, so -2.7 becomes -2. INT moves down, so -2.7 becomes -3.
MROUND returns an error if the number and the multiple have different signs. For example, =MROUND(10,-3) returns #NUM!.
Where to round in a calculation
Round at the point where the business rule says the value becomes final. Rounding too early or too late gives different totals.
Take a price of 19.994 sold in a quantity of 3, with prices that are billed to the cent:
=ROUND(A1,2)*3This returns 59.97. Rounding after multiplying gives a different answer:
=ROUND(A1*3,2)This returns 59.98, because 19.994*3 is 59.982. Neither is wrong in general. The rule you are modeling decides which one is correct.
Other places the stored value shows through
The stored value affects more than formulas:
- Copy and paste. A normal paste keeps the full value. Paste Values pastes the stored value, not the displayed text, so
19.994arrives as19.994. - Text output.
TEXT(A1,"0.00")returns the text19.99. This is a string, not a number, so it cannot be summed. TheTEXTfunction is covered in a later chapter. - CSV export. Saving a sheet as CSV writes cells as they are displayed. A value shown as
19.99is saved as19.99, and the extra digits are lost. If you need the full precision in the file, widen the format or round deliberately before export. - Charts. Axis values and data points use the stored value. Data labels use the cell's format.
Set precision as displayed
Excel has an option that makes the stored value match the display. It is under File, Options, Advanced, in the section "When calculating this workbook", named "Set precision as displayed".
When you turn it on, Excel permanently rounds every stored constant in the workbook to the number of decimals its format shows. This cannot be undone. The lost digits do not come back when you turn the option off.
Floating-point noise
Excel stores numbers in binary floating point, so some decimals cannot be stored exactly. A formula can produce a result that is a tiny amount away from the number you expect.
=(0.1+0.2)-0.3The exact result is about 5.55E-17, not zero. Excel hides some of this by treating results very close to zero as zero in certain subtractions, but the behavior is not reliable in comparisons. Round both sides when you test equality:
=ROUND(A1,2)=ROUND(B1,2)This is also the safe way to compare two money amounts that came from different calculations.
Choosing a tool
| Goal | Use |
|---|---|
| Show fewer decimals, keep full precision | A number format such as `0.00` |
| Make the stored value match what is billed or reported | `ROUND` |
| Always round up or down for limits and packaging | `ROUNDUP`, `ROUNDDOWN` |
| Round to a step such as 5 or 0.05 | `MROUND` |
| Drop decimals without rounding | `TRUNC` |
| Compare computed amounts | `ROUND` on both sides |
| Build a text label | `TEXT` |
Common mistakes
- Formatting a total to 0 decimals and then quoting the value as if it were a whole number.
- Rounding intermediate results, such as unit prices, when only the final total should be rounded.
- Using
TEXTto round a value and then trying to add the results. - Turning on "Set precision as displayed" in a shared workbook.
- Checking equality of calculated numbers without rounding.
Exercise
Cells A1 and A2 both contain 19.994 and are formatted with two decimals, so each shows 19.99. The cell =A1+A2 shows 39.99, but your invoice must show the sum of the two billed amounts, which is 39.98. Which formula gives that, and why does the plain sum show 39.99?
Show answer
Use =ROUND(A1,2)+ROUND(A2,2), which returns 39.98. The plain sum adds the stored values 19.994 + 19.994 = 39.988, and the two-decimal format displays that as 39.99. The format only changes the display, so each cell must be rounded with ROUND before the amounts are added.
Exercise
What do =TRUNC(-2.7) and =INT(-2.7) return, and what does =ROUND(-2.5,0) return?
Show answer
TRUNC(-2.7) returns -2, because it removes the fraction. INT(-2.7) returns -3, because it rounds down to the next lower integer. ROUND(-2.5,0) returns -3, because ROUND rounds half away from zero.