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.

Beginner 15 min read

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.

Formula
=B2*C2
=B2*C2*(1-D2)
=SUM(E2:E5)
=E6*0.24
Four typical formulas: a product, a product with a discount, a total, and VAT on the total.

Your first formula, step by step

  1. Type the price list below into A1:C5 (Item, Price, Qty).
  2. Click D1 and type the heading Total.
  3. Click D2 and type = (equals).
  4. Click cell B2 with the mouse. Excel writes B2 into the formula and draws a coloured border around it.
  5. Type * and then click C2. The formula now reads =B2*C2.
  6. Press Enter. The cell shows 140.
  7. Select D2 again and double-click the fill handle to copy the formula down to D5.
D4fx=B4*C4
ABCD
1ItemPriceQtyTotal
2Notebook3.540140
3Pen set6.225155
4Stapler11.9895.20
5Folder1.7560105

Each total is price times quantity.

Result: 95.20

Tip. Pointing at cells with the mouse (or the arrow keys) while building a formula is safer than typing addresses, because you can see exactly which cells you picked.

Arithmetic operators

OperatorMeaningExampleResult
+Addition=10+414
-Subtraction (or a negative sign)=10-46
*Multiplication=10*440
/Division=10/42.5
^Power (exponent)=10^2100
%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.

OperatorMeaningExampleResult
=Equal to=B2=3.5TRUE
<>Not equal to=A2<>"Pen set"TRUE
>Greater than=D2>100TRUE
<Less than=C4<10TRUE
>=Greater than or equal to=C3>=25TRUE
<=Less than or equal to=D5<=100FALSE

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.

C2fx=A2&" "&B2
ABC
1FirstLastFull name
2MariaLopezMaria Lopez
3JohnCarterJohn 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:

OrderOperatorDescription
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:

FormulaHow Excel reads itResult
=80*1-25%*1.2480×1 = 80, then 25%×1.24 = 0.31, then 80−0.3179.69
=80*(1-25%)*(1+24%)80 × 0.75 × 1.2474.4

Only the second one is correct. The lesson: whenever you mean "this whole amount", wrap it in parentheses.

D2fx=A2*(1-B2)*(1+C2)
ABCD
1List priceDiscountVATFinal price
28025%24%74.40

Inputs in cells, parentheses around each factor. D2 is formatted with two decimals.

Result: 74.40

Watch out. Negation comes before exponent in Excel. =-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 Ctrl together with the grave accent key (the key left of 1, on Mac also Ctrl) 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 F9 to 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 text B2*C2.
  • Typing a space before =. The entry becomes text.
  • Using x instead 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?

2. Which formula correctly applies a 10% discount to the price in A2 and then adds the VAT rate in B2?

3. What does ="Total"&" "&150 return?

4. What does =-3^2 return in Excel?

5. Why should a VAT rate be in its own cell instead of typed into every formula?

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 15 KB