Sub topic 3
Toggling reference types quickly
This chapter assumes you can enter formulas, read A1 addresses, and fill a formula with the fill handle. It covers the keyboard shortcut for changing reference types, a two-way table, locked ranges in lookup functions, references to other sheets, troubleshooting, and two alternatives.
Toggling reference types quickly
Place the cursor on a reference in the formula bar, then press Ctrl+4 (Command+4 on a Mac). Google Sheets cycles through four forms. You can also type the $ signs by hand.
> Note: Excel uses F4 for this. Google Sheets uses Ctrl+4.
Worked example: a multiplication table from one formula
Put row headers in A2:A5 and column headers in B1:E1. Enter this formula in B2:
=$A2*B$1$A2 locks column A, so each row uses its own header. B$1 locks row 1, so each column uses its own header. Fill right to E2, then fill down to E5. One formula fills all 16 cells.
Locking ranges in SUMIF, COUNTIF and VLOOKUP
Lookup and criteria ranges must stay fixed when a formula fills down. Otherwise the range shifts and returns wrong results.
=SUMIF($A$2:$A$100, D2, $B$2:$B$100)Only D2 is relative, so each row checks its own criterion.
Absolute references to another sheet
Keep a rate on a sheet named Settings in cell B1. Then reference it with absolute notation:
=A2*Settings!$B$1Every copied formula reads the same rate cell.
Troubleshooting wrong results after copying
The most common error is a missing $ on a fixed cell. If B2 contains =A2*E1 and you fill it down, B3 becomes =A3*E2. The rate drifts into blank cells, and the results become zero or wrong. Click each copied cell and check whether the highlighted references moved when they should have stayed put.
Alternatives: named ranges and ARRAYFORMULA
A named range gives a fixed cell a readable name. Open Data > Named ranges, name Settings!B1 TaxRate, and use:
=A2*TaxRateARRAYFORMULA computes a whole column from one formula without copying:
=ARRAYFORMULA(A2:A*0.2)Exercise
Exercise
Cell B2 contains =A2*$E$1. You fill it down to B3. What does B3 contain?
Show answer
=A3*$E$1. The column letter and row number of A2 move down one row, while $E$1 stays fixed.