MarzleyTech Learn

Home / Learn / Excel & Google Sheets / Formulas and cell references: relative, absolute and mixed

Formulas and cell references: relative, absolute and mixed

The real power of a spreadsheet is that one formula can be copied down hundreds of rows. To do that correctly you must understand cell references, the most important concept in Excel and Google Sheets.

Formulas recap

Every formula starts with =:

FormulaResult
=B2*C2Multiply two cells
=SUM(D2:D10)Add a range
=D11*16%16% of a cell
=(B2+C2)/2Brackets control the order

Order of operations: brackets, then ^ (power), then * and /, then + and -.

Relative references (the default)

In this price list, D2 has =B2*C2:

ABCD
1ItemPriceQtyTotal
2Unga1803=B2*C2 → 540
3Sugar1602=B3*C3 → 320
4Oil3501=B4*C4 → 350

When you copy D2 down (drag the fill handle, the small square at the cell's corner, or double-click it), Excel adjusts the references: row 3 gets =B3*C3. That's a relative reference: it means "the cell two to the left, on my row".

Absolute references: $ locks a cell

Now add VAT using a rate stored in one cell, F1 = 16%. In E2 you type =D2*F1 and copy down... row 3 becomes =D3*F2, which is empty. Wrong!

Lock the rate with dollar signs: =D2*$F$1. Now every row uses F1.

DE (VAT)F
1TotalVAT16%
2540=D2*$F$1 → 86.40
3320=D3*$F$1 → 51.20

Shortcut: after typing a reference, press F4 to cycle through F1 → $F$1 → F$1 → $F1.

Mixed references

ReferenceColumnRowUse when
B2changeschangesNormal row-by-row formulas
$B$2fixedfixedOne constant cell (rate, target)
$B2fixedchangesAlways read column B, any row
B$2changesfixedAlways read row 2, any column

Classic example: a multiplication table or a price grid. In B2, =$A2*B$1 copied across and down multiplies each row header by each column header.

Referencing other sheets

=Prices!B2                (cell B2 on the sheet called Prices)
=SUM('Term 1'!C2:C40)     (quote sheet names that contain spaces)

Named ranges: easier to read

Select F1, type a name like VAT in the Name Box (left of the formula bar) and press Enter. Now write =D2*VAT: clear, and automatically absolute.

Common errors and what they mean

ErrorMeaningUsual fix
#DIV/0!Dividing by zero or an empty cell=IFERROR(A2/B2, 0) or check B2
#VALUE!Text where a number is expectedRemove spaces/letters from numbers
#REF!A referenced cell was deletedUndo, or fix the formula
#NAME?Misspelled function or nameCheck spelling: =SUM, not =SUMM
#N/ALookup value not foundSee the Lookups lesson
######Column too narrowWiden the column

Show all formulas at once with Ctrl + ` (the key left of 1), great for checking a sheet.

Practice

Build a fee sheet: columns Name, Fee, Paid, Balance (=B2-C2), and a % paid column =C2/B2 formatted as a percentage. Add a cell with a late-payment penalty rate and a Penalty column that uses it with an absolute reference.

Why cell references matter

The power of a spreadsheet is that you write a formula once and copy it to hundreds of rows. Cell references decide what happens when you copy: whether the formula follows along (relative) or keeps pointing at one fixed cell (absolute), such as a VAT rate, commission percentage or exchange rate. Almost every spreadsheet error in offices, SACCOs, schools and shops comes from a wrong reference, and fixing it is a skill employers test in interviews.

WhoTypical use
Accountants and bookkeepersVAT, withholding tax and totals across many rows
Sales teamsCommission = sales × a fixed rate in one cell
TeachersMarks out of different totals converted to percentages
Shop ownersPrice lists with a markup percentage that changes occasionally
HR/payrollNSSF, SHIF and PAYE rates kept in a settings sheet

Worked example: a price list with a markup

ABCD
1Markup25%
2ItemCostSelling priceProfit
3Unga 2kg150=B3*(1+$B$1)=C3-B3
4Sugar 1kg170=B4*(1+$B$1)=C4-B4
5Cooking oil 1L300=B5*(1+$B$1)=C5-B5

Type the formula in C3 once and drag the fill handle down. B3 changes to B4, B5 (relative), but $B$1 stays fixed. Change the markup in B1 to 30% and every selling price updates instantly. This is the habit that separates a spreadsheet from a calculator: put changeable values in their own cells and reference them.

Building a multiplication or pricing grid with mixed references

A grid where rows are quantities and columns are prices uses one formula for the whole table:

ABCD
1Qty \ Price50100250
21=$A2*B$1
35
410

Enter =$A2*B$1 in B2 and fill right and down. $A keeps reading the quantity column; $1 keeps reading the price row. One formula fills all 9 cells correctly.

Settings sheets: a professional pattern

Keep rates and constants on a separate sheet called Settings:

Settings!B1   VAT rate          16%
Settings!B2   Commission rate   5%
Settings!B3   USD to KES rate   (update when it changes)

Then formulas read them:

=C2*Settings!$B$1          VAT for the row
=D2*Settings!$B$2          commission
='Sales Data'!B5           a sheet name with spaces needs single quotes

Better still, name the cells (Formulas → Define Name, or type in the Name Box left of the formula bar): =C2*VAT_Rate reads like English and never needs $ signs, because names are always absolute.

References to whole columns and ranges

ReferenceMeans
B2:B100Cells B2 to B100
B:BThe entire column B (handy for totals that grow)
2:2The entire row 2
B2:D10A rectangle of cells
Sales[Amount]A column in an Excel Table (structured reference)
=SUM(B:B)                  total of a whole column (don't put the total inside column B!)
=SUM(Sales[Amount])        Table column: grows automatically as rows are added
=AVERAGE(B2:B31)           average of 30 days

Putting =SUM(B:B) inside column B creates a circular reference (the formula includes itself), and Excel warns you.

3D references: the same cell across sheets

If you have one sheet per month (Jan, Feb, Mar) with the same layout:

=SUM(Jan:Mar!B10)          adds B10 from every sheet between Jan and Mar

This is how a quarterly summary is built from monthly sheets without retyping.

Tracing and checking formulas

ToolWhereUse
Show FormulasCtrl + ` (the grave-accent key above Tab) | See every formula instead of results
Trace PrecedentsFormulas → Formula AuditingArrows show which cells feed this formula
Trace DependentsSame groupArrows show which formulas use this cell
Evaluate FormulaSame groupStep through a formula calculation
F2On a cellEdit mode; referenced cells are coloured

Before sending a spreadsheet to a manager or client, press Ctrl + ` and scan for formulas that point to the wrong place or hard-typed numbers where a formula should be.

Avoid hard-coded numbers

BadBetter
=B2*0.16=B2*VAT_Rate
=B2*1.25=B2*(1+$B$1)
=SUM(B2:B31)/30=AVERAGE(B2:B31) or =SUM(...)/COUNT(...)

Hard-coded numbers hide inside formulas. When the rate changes, someone has to find and fix every formula, and usually misses some.

Common reference errors in real work

SymptomLikely causeFix
Copied formula gives 0 or wrong values further downRate cell not lockedUse $B$1 or a name
#REF! after deleting a columnFormula pointed to the deleted cellsUndo, or rewrite the reference
Totals don't include new rowsRange stops at a fixed rowUse a Table or extend the range
Circular reference warningFormula includes its own cellMove the total outside the range
Numbers stored as text (left aligned, green triangle)Imported dataConvert with the warning menu or =VALUE()

Practice

  1. Build a price list with a markup cell and selling prices that update when the markup changes.
  2. Make a 10 × 10 multiplication table using a single formula with mixed references.
  3. Create a Settings sheet with VAT and commission rates, name them, and use the names in a sales sheet.
  4. Make three monthly sheets with the same layout and a summary using a 3D reference.
Think about it: A commission sheet uses =B2*E1 in C2, where E1 holds 5%. After copying down, C3 shows 0. Why, and what's the fix?Show answer

When copied down, E1 became E2, which is empty, so the result is 0 (and E3, E4 and so on further down). Lock the rate with $E$1, or give E1 a name like Commission_Rate and use =B2*Commission_Rate.

Check yourself

  1. What symbol locks a column or row in a cell reference?

    Show answer

    $

  2. Which key cycles through $F$1, F$1 and $F1 after typing a reference?

    Show answer

    F4

  3. You copy =B2*C2 down one row. What does it become?

    Show answer

    =B3*C3

  4. Which error appears when dividing by zero?

    Show answer

    #DIV/0!

  5. Which reference always reads column B but lets the row change: $B2 or B$2?

    Show answer

    $B2

  6. Which shortcut shows formulas instead of results in every cell?

    Show answer

    Ctrl + `

  7. What is it called when a formula refers to its own cell? (two words)

    Show answer

    circular reference

  8. Do named ranges need $ signs to stay fixed when copied? (yes or no)

    Show answer

    no

Lesson 2 of 11 in Excel & Google Sheets · Printable course notes