Sub topic 5
Percentage, scientific, and fraction formats
This chapter assumes you can apply a built-in format from Format Cells, know that a number format changes only how a value looks, and can read the basic custom codes (0, #, ., ,). Here you will see how three display styles work: percentage, scientific, and fraction. Each is a different way to show the same stored number.
Percentage format
The Percentage format multiplies the stored value by 100 for display and adds a % sign. The stored value does not change. A cell that shows 25% holds 0.25.
| Stored value | Format | Displayed |
|---|---|---|
| 0.25 | `0%` | 25% |
| 0.0456 | `0%` | 5% |
| 0.0456 | `0.0%` | 4.6% |
| 1.5 | `0%` | 150% |
| -0.032 | `0.0%` | -3.2% |
The built-in Percentage format defaults to two decimal places. You can change this with the Increase Decimal and Decrease Decimal buttons or in Format Cells.
How the stored value gets there
There are three ways a percentage ends up in a cell, and they behave differently.
- Typing a number with a percent sign. If you type
5%into a General cell, Excel stores 0.05 and applies a percentage format automatically. - Typing into a cell that is already formatted as Percentage. This depends on the option Enable automatic percent entry (File > Options > Advanced). When it is on, typing
10and typing0.1both give 10%. When it is off, typing10gives 1000%. - A formula.
=B2/B$10returns a plain fraction such as 0.18. You apply the Percentage format yourself.
=B2/B$10If the result shows 0.18 instead of 18%, the formula is correct and the cell just needs the format.
Percent in custom codes
In a custom code, an unquoted % does two things: it prints the symbol and it multiplies the value by 100. If you want the symbol without the multiplication, quote it or escape it with a backslash.
0.0%0.0"%"The first code shows 0.256 as 25.6%. The second shows the same value as 0.3%, because there is no multiplication, and the stored 0.256 rounds to 0.3. Use the quoted form only when the column already holds values like 25.6 that mean percent.
You can also combine percent with sections, which the previous chapters introduced. This code shows negative percentages in red:
0.0%;[Red]-0.0%Percentages and rounding
Because the format only changes the display, rounded percentages may not appear to add up. Three values of 1/3 each display as 33% with the 0% format. Their total is exactly 1, so the sum cell shows 100%, but the three visible numbers add to 99%. If the displayed numbers must add up, round the stored values with ROUND. Keep in mind that this changes the data.
=ROUND(B2/B$10,2)Scientific format
The Scientific format shows a number as a coefficient times a power of ten. The built-in version is 0.00E+00. The number 12345 displays as 1.23E+04, which means 1.23 × 10⁴.
The parts of the code are:
0.00sets the digits of the coefficient. One digit before the decimal point and two after.E+marks the exponent and always shows its sign.E-shows a sign only for negative exponents.00sets the minimum number of exponent digits.
0.000E+00With this code, 12345 shows as 1.235E+04 and 0.00042 shows as 4.200E-04. The decimals control rounding of the coefficient only. The stored value keeps all its digits.
Engineering notation
Engineering notation keeps the exponent a multiple of three, which matches unit prefixes such as kilo, mega, and milli. Use up to three # or 0 characters before the decimal point.
##0.0E+0The number 12345 displays as 12.3E+3, and 0.00042 displays as 420.0E-6. The coefficient can have one to three digits before the point, so the exponent is always a multiple of three.
Scientific display you did not ask for
Excel can show scientific notation in cells formatted as General. The General format switches to it when a number is too wide for the column. This happens, for example, with numbers of 12 or more digits. This is a display decision only, and widening the column often fixes it.
A related problem is more serious. Excel keeps only 15 significant digits. If you type a 16-digit identifier such as a card number into a numeric cell, Excel replaces every digit after the 15th with a zero. This is permanent data loss, and no format can bring the digits back. For identifiers, set the cell to Text format before you enter the data. The Text format chapter covers this.
Fraction format
The Fraction format shows the fractional part of a number as a ratio of whole numbers. The stored value is still a decimal. Excel searches for the closest fraction that fits the format you chose.
Excel provides these built-in fraction formats:
| Built-in name | Custom code | 0.75 shows | 2.5 shows |
|---|---|---|---|
| Up to one digit | `# ?/?` | 3/4 | 2 1/2 |
| Up to two digits | `# ??/??` | 3/4 | 2 1/2 |
| Up to three digits | `# ???/???` | 3/4 | 2 1/2 |
| As halves | `# ?/2` | 1/2 | 2 1/2 |
| As quarters | `# ?/4` | 3/4 | 2 2/4 |
| As eighths | `# ?/8` | 6/8 | 2 4/8 |
The ? placeholder works like 0 or #, but it pads with a space instead of a zero. That is why the fraction parts line up in a column. The # before the space holds the whole-number part. Without it, a code such as ?/? shows an improper fraction, so 2.5 displays as 5/2.
Fixed denominators
When the denominator is a literal number, Excel uses that denominator and rounds the numerator to the nearest whole value. This is useful for measurements such as sixteenths of an inch.
# ?/16With this code, 0.3 displays as 5/16, because 0.3 × 16 = 4.8, which rounds to 5. The stored value is still 0.3, so any formula that uses the cell sees 0.3 and not 0.3125.
Approximation
A format with a limited number of digits gives an approximation. The value 0.1234 with # ?/? shows 1/8, since no one-digit denominator gets closer. If the exact ratio matters, use more digits or keep the decimal.
Entering fractions
If you type 1/2 into a General cell, Excel reads it as a date (1 February of the current year, or January 2 in some regional settings). Type a zero and a space first, as in 0 1/2, to enter the value 0.5 as a fraction. After that, Excel applies a fraction format to the cell.
Choosing between the three
Using these formats in text
The TEXT function applies the same codes inside a formula and returns text. Use it when a label needs a formatted value.
=TEXT(0.256,"0.0%")This returns the text 25.6%. The result is text, so you cannot use it in arithmetic without converting it back. The TEXT function has its own chapter.
Common errors
- Typing 5 and getting 500%. The cell is formatted as Percentage and automatic percent entry is off. Type
5%instead, or turn the option on. - Percentages that do not add up. The format is hiding decimals. Round the stored values with
ROUNDif the visible numbers must add up. - Trailing zeros after 15 digits. Excel's 15-digit limit. Re-enter the data as text.
- A fraction typed as a date. Enter it as
0 1/2, or format the cell as Fraction before typing. - Fraction not what you typed. Fixed denominators and digit limits round the display. Check the stored value in the formula bar.
Exercise
Cell A1 holds 0.0725. What does it display with each of these codes: 0%, 0.0%, 0.00E+00, and # ??/??? Which of these changes the stored value?
Show answer
With 0% it displays 7%. With 0.0% it displays 7.3% (7.25 rounds to 7.3 in Excel's display). With 0.00E+00 it displays 7.25E-02. With # ??/?? it displays 2/28, the closest fraction with at most two digits in the denominator (0.0714), so the display is only an approximation. None of the formats changes the stored value. A1 still holds 0.0725.
Exercise
A column of lengths in inches is stored as decimals such as 3.4375. Write a custom format that shows them as mixed numbers in sixteenths, and say what a formula referring to the cell sees.
Show answer
Use # ?/16. The value 3.4375 displays as 3 7/16, because 0.4375 × 16 = 7. A formula referring to the cell sees the stored decimal 3.4375, not text, so arithmetic stays exact.