Excel course · Lesson 3 of 34
Formula basics: operators and order of operations
Write your first Excel formulas: arithmetic operators, comparison and text operators, and the order in which Excel calculates, with worked examples.
A formula is an instruction that tells Excel to calculate something. Formulas are what turn a grid of numbers into a working model: change one input and every total, percentage and forecast updates instantly. In this lesson you will write formulas by hand, learn every operator Excel understands, and find out why =2+3*4 gives 14 and not 20.
Anatomy of a formula
Every formula starts with an equals sign =. Without it Excel treats your entry as text. After the = comes an expression made of values (such as 100 or "North"), cell references (such as B2), operators (such as + or *) and functions (such as SUM). When you press Enter, the cell shows the result while the formula bar keeps showing the formula.
=B2*C2
=B2*C2*(1-D2)
=SUM(E2:E5)
=E6*0.24Your first formula, step by step
- Type the price list below into
A1:C5(Item, Price, Qty). - Click
D1and type the headingTotal. - Click
D2and type=(equals). - Click cell
B2with the mouse. Excel writesB2into the formula and draws a coloured border around it. - Type
*and then clickC2. The formula now reads=B2*C2. - Press
Enter. The cell shows 140. - Select
D2again and double-click the fill handle to copy the formula down toD5.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Item | Price | Qty | Total |
| 2 | Notebook | 3.5 | 40 | 140 |
| 3 | Pen set | 6.2 | 25 | 155 |
| 4 | Stapler | 11.9 | 8 | 95.20 |
| 5 | Folder | 1.75 | 60 | 105 |
Each total is price times quantity.
Result: 95.20
Arithmetic operators
| Operator | Meaning | Example | Result |
|---|---|---|---|
| + | Addition | =10+4 | 14 |
| - | Subtraction (or a negative sign) | =10-4 | 6 |
| * | Multiplication | =10*4 | 40 |
| / | Division | =10/4 | 2.5 |
| ^ | Power (exponent) | =10^2 | 100 |
| % | Percent (divides by 100) | =200*15% | 30 |
Notice that Excel uses * for multiplication and / for division, not × and ÷. The ^ operator also handles roots: =16^(1/2) is the square root of 16, which is 4.
Comparison operators
Comparison operators compare two values and return TRUE or FALSE. On their own they are useful for quick checks; inside functions like IF they make decisions, as you will see in IF and logical formulas: AND, OR, NOT, IFS and SWITCH.
| Operator | Meaning | Example | Result |
|---|---|---|---|
| = | Equal to | =B2=3.5 | TRUE |
| <> | Not equal to | =A2<>"Pen set" | TRUE |
| > | Greater than | =D2>100 | TRUE |
| < | Less than | =C4<10 | TRUE |
| >= | Greater than or equal to | =C3>=25 | TRUE |
| <= | Less than or equal to | =D5<=100 | FALSE |
These results use the price list above: D2 is 140, C4 is 8, C3 is 25 and D5 is 105. Text comparisons are not case-sensitive, so ="north"="NORTH" returns TRUE.
The text operator &
The ampersand & joins text together (this is called concatenation). Put literal text in double quotes and remember to add spaces yourself.
| A | B | C | |
|---|---|---|---|
| 1 | First | Last | Full name |
| 2 | Maria | Lopez | Maria Lopez |
| 3 | John | Carter | John Carter |
The & operator joins first name, a space, and last name.
Result: Maria Lopez
You can join numbers too: =A2&" bought "&C2&" units". The result is always text. To control how a number looks inside joined text, wrap it in TEXT, for example ="Total: "&TEXT(D6,"#,##0.00").
Order of operations
When a formula contains several operators, Excel does not simply work left to right. It follows a fixed order of precedence, the same one you learned at school, plus a few Excel-specific rules:
| Order | Operator | Description |
|---|---|---|
| 1 | ( ) | Anything in parentheses is calculated first |
| 2 | - | Negation, as in -5 |
| 3 | % | Percent |
| 4 | ^ | Exponent |
| 5 | * and / | Multiplication and division, left to right |
| 6 | + and - | Addition and subtraction, left to right |
| 7 | & | Text concatenation |
| 8 | = < > <= >= <> | Comparison |
So =2+3*4 multiplies first (3×4 = 12) and then adds 2, giving 14. If you want the addition first, use parentheses: =(2+3)*4 gives 20.
A real-world example: price after discount plus VAT
A shop sells a jacket for 80, gives a 25% discount and then adds 24% VAT. Compare two formulas:
| Formula | How Excel reads it | Result |
|---|---|---|
| =80*1-25%*1.24 | 80×1 = 80, then 25%×1.24 = 0.31, then 80−0.31 | 79.69 |
| =80*(1-25%)*(1+24%) | 80 × 0.75 × 1.24 | 74.4 |
Only the second one is correct. The lesson: whenever you mean "this whole amount", wrap it in parentheses.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | List price | Discount | VAT | Final price |
| 2 | 80 | 25% | 24% | 74.40 |
Inputs in cells, parentheses around each factor. D2 is formatted with two decimals.
Result: 74.40
=-2^2 returns 4, not −4, because Excel squares −2. Mathematicians would expect −4. Write =-(2^2) or =0-2^2 when you mean the negative of a square.Use references, not typed numbers
It is tempting to type =80*0.75*1.24. It works today, but the day VAT changes you have to find every formula that contains 1.24. Put inputs such as tax rates in their own cells and refer to them. Then one change updates the whole workbook, and anyone reading the sheet can see where a number comes from. In Cell references: relative, absolute and mixed you will learn how to point many formulas at a single rate cell with $ signs, and in Named ranges: give cells meaningful names how to call that cell VAT.
Showing formulas and recalculation
- Press
Ctrltogether with the grave accent key (the key left of1, on Mac alsoCtrl) or choose Formulas › Formula Auditing › Show Formulas to see every formula on the sheet instead of the results. Press it again to switch back. - Excel recalculates automatically. If results stop updating, check Formulas › Calculation › Calculation Options; it should say Automatic. Press
F9to force a recalculation. - A formula that refers to its own cell creates a circular reference and Excel shows a warning. Usually this is a mistake; fix the reference.
Common beginner mistakes
- Forgetting the
=. The cell then shows the textB2*C2. - Typing a space before
=. The entry becomes text. - Using
xinstead of*for multiplication. Excel returns#NAME?. - Dividing by an empty cell, which gives
#DIV/0!. See Formula errors: what each one means and how to fix it. - Numbers stored as text (left-aligned, often with a green triangle). Formulas may ignore them or return
#VALUE!.
Check yourself
1. What does =2+3*4 return?
Multiplication comes before addition: 3×4 = 12, then 2+12 = 14.
2. Which formula correctly applies a 10% discount to the price in A2 and then adds the VAT rate in B2?
Each factor needs parentheses: price × (1 − discount) × (1 + VAT).
3. What does ="Total"&" "&150 return?
The & operator joins text; numbers are converted to text, so the result is the text 'Total 150'.
4. What does =-3^2 return in Excel?
Negation is evaluated before the exponent, so Excel calculates (−3)² = 9.
5. Why should a VAT rate be in its own cell instead of typed into every formula?
Inputs in cells make the model easy to update and easy to audit.