Sub topic 3
Referring to Cells on Other Sheets
This chapter assumes you can open a Google Sheets file, enter values, use the basic operators, and write formulas with A1 references such as B2:B10.
Referring to cells on other sheets
Type the sheet name, an exclamation mark, then the cell. Wrap the sheet name in single quotes when it contains a space.
='Sales Data'!B2Naming ranges to make formulas readable
Choose Data, then Named ranges, and give a range a name such as Prices. The formula =SUM(Prices) then replaces =SUM(B2:B10). Names cannot contain spaces or look like cell references.
Fixing #REF!, #NAME?, and #DIV/0! errors
#REF!: the reference is invalid, often after a row, column, or sheet was deleted. Point the formula at the correct range.#NAME?: Sheets does not recognize a name. Check for a misspelled function, a missing quote around a sheet name, or an unknown named range.#DIV/0!: the divisor is zero or blank. Guard it with=IFERROR(B2/C2, 0).
Open-ended ranges for growing data
=SUM(B2:B) includes every row of column B from row 2 down, so rows added later are counted automatically.
Applying one formula to a whole range with ARRAYFORMULA
=ARRAYFORMULA(IF(B2:B="","",B2:B*C2:C))One cell computes results for every row. The results fill the cells below it, so those cells must be empty.
Pulling data from another spreadsheet with IMPORTRANGE
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/SPREADSHEET_ID","Sheet1!A1:C10")Replace SPREADSHEET_ID with the ID from the file's URL. The first time, click Allow access.
Building references from text with INDIRECT
=INDIRECT("'"&A1&"'!B2")INDIRECT builds a reference from a string, so changing A1 changes the sheet it reads. It recalculates often, so use it sparingly.
Exercise
Column D should total every value in column B, including rows added later. Which formula do you enter?
Show answer
=SUM(B2:B)