Sub topic 3
Adding, Subtracting, Multiplying, and Dividing
This chapter assumes you can open a workbook, select a cell, type a value, and press Enter. It also assumes you know that a formula starts with an equals sign. Here you will use the four basic arithmetic operators and learn what Excel does when it can't calculate.
The four operators
An operator is a symbol that tells Excel which calculation to perform. Excel uses the same symbols as most programming languages, and two of them differ from what you write by hand.
| Operation | Operator | Example | Result |
|---|---|---|---|
| Addition | `+` | `=8+5` | 13 |
| Subtraction | `-` | `=8-5` | 3 |
| Multiplication | `*` | `=8*5` | 40 |
| Division | `/` | `=8/5` | 1.6 |
Use * for multiplication, not x. Use / for division, not ÷. If you type =8x5, Excel doesn't recognize the x as an operator and rejects the formula.
Try each operator with typed numbers
Select an empty cell and type one of these formulas. Press Enter, and the cell shows the result. The formula stays visible in the formula bar when you select the cell again.
=120+45This returns 165.
=120-45This returns 75.
=120*3This returns 360.
=10/4This returns 2.5. Excel does not round a division result to a whole number. The number of decimals you see depends on the cell's number format and the column width, but the stored value keeps full precision.
Spaces around operators are allowed and are ignored, so =120 + 45 and =120+45 give the same result. Most people leave them out to keep formulas short.
The same operators with cell references
Typed numbers are fine for practice, but real worksheets use cell references. A cell reference is the address of a cell, such as A2. The next chapter covers references in detail. For now, you only need to know that a reference makes Excel use whatever value the cell holds.
Suppose A2 holds a revenue figure of 120 and B2 holds a cost of 45. The operators work the same way:
=A2-B2This returns 75. If you change B2 to 50, the result becomes 70 without any edit to the formula.
The spine's own example uses multiplication the same way. If B2 holds a unit price and C2 holds a quantity, this formula returns the line total and updates when either cell changes:
=B2*C2You can mix references and typed numbers in one formula. For example, =A2+10 adds 10 to whatever A2 holds.
What Excel does with empty and text cells
Operators expect numbers. Two situations come up often.
- An empty cell counts as 0. If B2 is empty,
=A2+B2returns the value of A2, and=A2*B2returns 0. - A cell holding words can't be used in arithmetic. If A1 holds the word
apples, then=A1+1returns#VALUE!. Excel can't add a number to text.
Numbers that were pasted or imported as text are a common cause of #VALUE!. They often show with a small green triangle in the cell corner or align to the left side of the cell. Retyping the number usually fixes it.
Dividing by zero
Division by zero is undefined in mathematics, and Excel reports it with an error value instead of a number. Consider this formula:
=A2/B2If B2 holds 0, or is empty, the cell shows #DIV/0!. The formula isn't broken. The data in B2 is the problem. When you see this error, check the divisor first.
=A2/B2With A2 holding 120 and B2 holding 40, this returns 3. Change B2 to 0 and it returns #DIV/0!. Change B2 back and the result returns, because Excel recalculates automatically.
Two other errors, #NAME? and #VALUE!, get fuller treatment in a later chapter. The #VALUE! case above is the one you are most likely to meet with these four operators.
Using more than one operator
You can chain operators in one formula, for example =A2+B2-C2. When a formula mixes + and *, or - and /, Excel does not always work from left to right. It follows a fixed order, which can change the answer. That order is the subject of a later chapter, so for now keep practice formulas to one operator each.
Common mistakes
- Forgetting the leading
=. Excel then treats120+45as text and shows it unchanged. - Typing
xor÷instead of*or/. - Dividing by a cell that is empty or zero, which produces
#DIV/0!. - Doing arithmetic on a cell that holds text, which produces
#VALUE!.
Exercise
Cell A2 holds 250 and cell B2 holds 40. What does =A2/B2 return? What does it return if you delete the contents of B2, and why?
Show answer
It returns 6.25. After B2 is emptied, Excel treats the empty cell as 0 and the formula returns #DIV/0!, because division by zero is undefined.
Exercise
Cell A1 holds the word "total" and you enter =A1+5 in B1. What appears in B1, and what is the cause?
Show answer
B1 shows #VALUE!. The + operator needs numbers, and A1 holds text, so Excel can't add 5 to it.