Lesson 9 of 92 · Free Excel Course
Excel
How to Make Formulas in Excel: The = Sign, Operators and Fixing Errors
Learn how to make formulas in Excel: start with =, use + - * / ^ and &, get the order of operations right, copy formulas down and fix common errors.
So far in this course you've typed numbers, text and dates into cells. Now Excel starts doing the work. A formula is a small instruction that tells Excel to calculate something, and the answer updates by itself whenever the numbers change. This lesson shows you how to make formulas in Excel from scratch: the = sign, the maths symbols, the order Excel works in, how to copy one formula down a whole column, and what to do when a cell suddenly shows #DIV/0! or #NAME?. You don't need any maths beyond what you'd use to check a receipt.
What a formula is
Every formula in Excel begins with an equals sign (=). That one character is how Excel knows you want a calculation and not plain text. Type 10+5 into a cell and Excel shows "10+5". Type =10+5 and it shows 15.
A formula can contain three kinds of things:
- Numbers you type, like
=10+5. - Cell references, like
=B2*C2, which means "the number in B2 times the number in C2". - Functions, like
=SUM(D2:D5). These are ready-made formulas with names. You'll meet your first one in the next lesson.
Here is the key idea: the cell shows the result, but the formula bar (the long box above the column letters) shows the formula itself. Click any cell with a formula and look up. That's how you tell a typed number from a calculated one.
Your first formula, step by step
Let's build a tiny shopping list. Type this into a new sheet (or open the practice workbook from the "Try it yourself" section below): item names in column A, a quantity in column B and a price in column C.
- Click cell D2. This is where the answer will go.
- Type
=. You'll see the = appear in the cell and in the formula bar. - Click cell B2. Excel writes B2 into your formula and puts a coloured border around the cell.
- Type
*(Shift+8 on most keyboards). In Excel the asterisk means "multiply". - Click cell C2. The formula now reads
=B2*C2. - Press Enter. On a Mac, press Return.
Cell D2 now shows $1.50, because 3 apples at $0.50 each is $1.50. Click D2 again and the formula bar shows =B2*C2.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Item | Qty | Price | Line total |
| 2 | Apples | 3 | $0.50 | $1.50 |
| 3 | Bread | 2 | $2.25 | |
| 4 | Milk | 4 | $1.10 | |
| 5 | Eggs | 1 | $3.80 |
You can also type the whole thing by hand, =b2*c2, and Excel will turn the letters into capitals for you. Clicking cells is safer for beginners, because you can see exactly which cells you picked. Excel for the web works the same way. On a Mac the only difference is Return instead of Enter.
The operators: + - * / ^ and &
Operators are the symbols that do the maths. You need just six to start:
| Symbol | What it does | Example | Result |
|---|---|---|---|
| + | Add | =10+5 | 15 |
| - | Subtract | =10-5 | 5 |
| * | Multiply | =10*5 | 50 |
| / | Divide | =10/5 | 2 |
| ^ | Power ("to the power of") | =2^3 | 8 |
| & | Join text together | ="Ana"&" "&"Lopez" | Ana Lopez |
Two of these trip people up. Multiply is the asterisk, not the letter x. Divide is the forward slash, not the ÷ symbol. The ampersand (&) isn't maths at all: it glues pieces of text together. If A15 holds "Ana" and B15 holds "Lopez", then =A15&" "&B15 gives "Ana Lopez". The " " in the middle is a space inside quotation marks, so the two names don't run together.
Subtract, multiply and divide get a full lesson of their own later in the course: Subtract, multiply, divide. For now, just get used to typing them.
Order of operations: why brackets matter
Excel doesn't always work left to right. Like the maths you learned at school, it follows an order:
- Anything in brackets (parentheses) first.
- Then powers (^).
- Then multiply and divide, left to right.
- Then add and subtract, left to right.
So =10+5*2 gives 20, not 30. Excel multiplies first (5 times 2 is 10) and then adds (10 plus 10 is 20). If you really meant "add 10 and 5, then double it", wrap the addition in brackets: =(10+5)*2 gives 30.
This matters most for averages. Say you scored 80, 90 and 70 on three tests. If you type =80+90+70/3, Excel divides only the 70 by 3 and then adds, giving about 193.33, which is clearly wrong. Type =(80+90+70)/3 and you get 80, the real average.
When in doubt, add brackets. Extra brackets never hurt, but every opening bracket needs a matching closing one, or Excel will warn you before it lets you press Enter.
Use cell references, not typed numbers
You could write the apples formula as =3*0.5. It shows the same $1.50. The problem comes later. If you buy 5 apples instead of 3, you change B2 to 5, and =3*0.5 still says $1.50. It doesn't know B2 exists.
=B2*C2 reads whatever is in B2 and C2 right now, so it updates the moment either cell changes. That's the whole point of a spreadsheet. A good rule: put each number in its own cell once, then point formulas at it.
One more thing to avoid: don't type dollar signs or thousands commas inside a formula. Write =1200*2, not =$1,200*2. In formulas, the dollar sign and the comma mean other things to Excel, so let cell formatting (from Format cells) handle how money looks.
Copy a formula down with the fill handle
You don't need to type a new formula for every row. Write it once, then copy it.
- Click D2, the cell with your formula.
- Point at the small square at the bottom-right corner of the cell. That's the fill handle, and your pointer turns into a thin black plus sign.
- Drag down to D5 and let go.
Excel fills in the other rows and every answer is right. Click D3 and the formula bar says =B3*C3, not =B2*C2. Excel shifted the references down one row for you. These are called relative references: they move with the formula. You used the same fill handle for lists of months back in Entering data and AutoFill.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Item | Qty | Price | Line total |
| 2 | Apples | 3 | $0.50 | $1.50 |
| 3 | Bread | 2 | $2.25 | $4.50 |
| 4 | Milk | 4 | $1.10 | $4.40 |
| 5 | Eggs | 1 | $3.80 | $3.80 |
| 6 | Total | $14.20 |
Two quicker ways: select D2 to D5 and press Ctrl+D to fill down (this works in Excel for the web too), or double-click the fill handle to fill as far as the data next to it goes. Sometimes you need a reference that does not move when you copy it, such as a tax rate in one cell. That's an absolute reference, written with dollar signs, and it gets its own lesson: Absolute and relative references.
See and edit formulas: Show Formulas and F2
Show every formula at once. On the Formulas tab, click Show Formulas. Every cell now shows its formula instead of its result, and the columns widen so you can read them. Click the button again to switch back. The keyboard shortcut is Ctrl+`: hold Ctrl and press the grave accent key, which sits under Esc and to the left of 1 on most keyboards. On a Mac it's the same shortcut, Control plus the grave accent key. In Excel for the web, use the Show Formulas button on the Formulas tab.
Edit one formula.
- Click the cell.
- Press F2. Excel goes into Edit mode with the cursor at the end of the formula, and colour-codes each cell it uses.
- Use the arrow keys to move, fix what's wrong, then press Enter.
You can also double-click the cell, or click inside the formula bar and edit there. If you make a mess, press Esc before you press Enter and the cell goes back to how it was. On a Mac, F2 works too, though on some Mac keyboards you need to hold Fn while pressing F2, because the top row controls brightness and volume. Double-clicking the cell always works.
Common formula errors and how to fix them
When Excel can't work something out, it shows a short code that starts with #. Each one is a clue.
| You see | What it means | How to fix it |
|---|---|---|
| #DIV/0! | Dividing by zero or by an empty cell | Put a number in the cell you're dividing by, or point the formula at the right cell |
| #VALUE! | Maths on text, like a name times a price | Make sure every cell in the formula holds a number |
| #NAME? | Excel doesn't recognise a word, usually a misspelled function | Check the spelling: =SUMM(D2:D5) should be =SUM(D2:D5). Put text inside quotation marks |
| #REF! | A cell the formula used has been deleted | Press Ctrl+Z straight away to undo, or rewrite the formula with real cells |
| #### | Not an error: the column is too narrow | Double-click the right edge of the column letter to widen it |
| A | B | C | D | |
|---|---|---|---|---|
| 17 | Bill split | Total | People | Each pays |
| 18 | Dinner | $120.00 | #DIV/0! |
The #### one catches everybody. The number is fine; it just doesn't fit. You learned to widen columns in Rows and columns. The Excel errors and fixes lesson covers every error, including the trickier ones.
Try it yourself
Download the practice workbook and open the Practice sheet. Yellow cells are where you type.
- In D2, type
=B2*C2and press Enter. You should see $1.50. - Drag the fill handle from D2 down to D5. Check that D3 shows $4.50, D4 shows $4.40 and D5 shows $3.80.
- In D6, type
=D2+D3+D4+D5. The total is $14.20. - In C9 to C12, type each formula shown in column B. You should get 20, 30, 80 and 8. Can you explain why the first two differ?
- In C15, type
=A15&" "&B15to make "Ana Lopez". - Type 4 in C18 and watch the bill split change from
#DIV/0!to $30.00. - In rows 21 to 23, write a fixed formula for each broken one in column D.
- Press
Ctrl+`to see all your formulas, then press it again.
Compare your work with the Answers sheet. It has the working formulas and a note on each fix.
Common mistakes
- Forgetting the = sign. Without it,
B2*C2is just text. Click the cell, press F2, press Home, type = and press Enter. - Typing x for multiply.
=3x4gives an error. Use=3*4. - Leaving out brackets.
=80+90+70/3is not an average. Wrap the part you want done first:=(80+90+70)/3. - Typing numbers into the formula instead of using cells. The answer won't update when the data changes.
- Formula shows as text even with the = sign. The cell may have been formatted as Text before you typed, or there's a space before the =. Set the format to General (Home tab, Number group), then press F2 and Enter.
- Leaving Show Formulas on. If every cell suddenly shows formulas, press
Ctrl+`or click Show Formulas again. - Deleting a row a formula depends on. That causes
#REF!. Undo right away with Ctrl+Z.
What's next
You can now build, copy, check and fix a formula. Adding up long columns one cell at a time with + gets old fast, though, so the next lesson introduces your first function: Add and SUM, including the one-click AutoSum button. If dates are part of your sheets, Dates and times shows how formulas work with those too. You can always go back to the full Excel course.
Frequently asked questions
How do I start a formula in Excel?
Click the cell where you want the answer, type an equals sign (=), then type the calculation, such as =B2*C2, and press Enter (Windows) or Return (Mac). Without the = sign, Excel treats what you type as plain text.
Why is my Excel formula showing as text instead of the result?
The usual causes are: the formula doesn't start with =, there's a space before the =, the cell was formatted as Text before you typed, or Show Formulas is switched on (Formulas tab > Show Formulas). Fix the cause, then click the cell, press F2 and press Enter.
What order does Excel calculate a formula in?
Brackets first, then powers (^), then multiplication and division, then addition and subtraction, working left to right when two operators are at the same level. So =10+5*2 gives 20, but =(10+5)*2 gives 30.
What is the difference between a formula and a function?
A formula is anything you type that starts with =, like =B2*C2. A function is a ready-made formula with a name, like SUM or AVERAGE, that you use inside a formula: =SUM(B2:B5). The next lesson, Add and SUM, covers your first function.
How do I see all the formulas on a sheet at once?
Go to the Formulas tab and click Show Formulas, or press Ctrl and the grave accent key (the key under Esc, left of 1). The shortcut is the same on a Mac. Do it again to go back to results.
What does #DIV/0! mean in Excel?
It means the formula is dividing by zero or by an empty cell. Put a number in the cell you're dividing by, or point the formula at the right cell.