Sub topic 12
Alternatives: named ranges and ARRAYFORMULA
This chapter assumes that you can enter values and formulas in Google Sheets, read A1 cell addresses such as A2, and use basic arithmetic operators. It also assumes that you understand how copying a formula can change a relative reference.
The dollar sign is not the only way to keep formulas stable. Named ranges make fixed inputs easier to read. ARRAYFORMULA lets one formula calculate results for many rows. Each option solves a different problem.
Named ranges: readable fixed references
A named range is a label assigned to a cell or range. For example, you can name cell E1 TaxRate. A formula can then use TaxRate instead of $E$1.
To create one, select the cell or range, open Data > Named ranges, enter the name, and save it. A name cannot contain spaces, and it must not look like a cell address.
Named range:
TaxRate = E1
Cell E1:
0.2
Cell B2:
=A2*TaxRateWhen you copy the formula from B2 to B3, A2 changes to A3, but TaxRate still refers to the named cell.
Cell B3 after copying:
=A3*TaxRateNamed ranges are useful when a value has business meaning. TaxRate, ShippingFee, and DiscountLimit are easier to understand than $E$1, $H$2, and $K$4.
You can also name a range used by a function:
Named ranges:
Statuses = A2:A100
Amounts = B2:B100
Formula:
=SUMIF(Statuses, D2, Amounts)Here, D2 remains relative, so copying the formula down checks the next criterion. Statuses and Amounts continue to refer to the same ranges.
ARRAYFORMULA: one formula for many rows
ARRAYFORMULA applies a formula to a range of values. Instead of copying a formula down every row, enter one formula at the top of the result column.
Suppose column A contains prices and the named range TaxRate refers to cell E1. Enter this formula in B2:
=ARRAYFORMULA(IF(A2:A="", "", A2:A*TaxRate))The formula multiplies every non-empty price in A2:A by the fixed tax rate. The IF part keeps unused rows blank.
The result expands down column B automatically:
A2: 100 B2: 20
A3: 250 B3: 50
A4: 80 B4: 16The formula uses a named range for the fixed input and an open-ended range for future rows. If you add a price in A5, the result can appear in B5 without another copy operation.
flowchart TD
A[Prices in A2:A] --> B[ARRAYFORMULA in B2]
C[TaxRate named range] --> B
B --> D[Results fill down automatically]Choosing between the two
Named ranges and ARRAYFORMULA are not competing replacements. You can use them together.
| Option | Best use | Main risk |
|---|---|---|
| Named range | Give a fixed cell or range a clear name | The name may point to an outdated range |
| ARRAYFORMULA | Calculate a whole column from one formula | Existing content can block the expansion |
Use a named range when the main problem is readability or reuse. Use ARRAYFORMULA when the main problem is maintaining formulas across many rows. Use both when a column calculation depends on a shared setting.
Common errors and maintenance
A named range does not automatically make every formula correct. Check what the name refers to under Data > Named ranges. A range that ends at row 100 will not include data added in row 101 unless the range is expanded.
For ARRAYFORMULA, check these points:
- Put the formula in the first output cell, usually row 2.
- Leave the cells below it empty.
- Use range-compatible operations such as
A2:A*TaxRate. - Wrap the calculation in
IFwhen blank input rows should stay blank. - Do not edit individual cells inside the generated output area.
Named ranges improve meaning. ARRAYFORMULA reduces repeated formulas. Together, they can make a sheet easier to extend, but they also centralize behavior. A mistake in one top-level formula can affect an entire column.
Exercise
Cell E1 contains 0.15, and the named range TaxRate refers to E1. Prices begin in A2. What formula should you enter in B2 to calculate tax for every non-empty price without copying the formula down?
Show answer
=ARRAYFORMULA(IF(A2:A="", "", A2:A*TaxRate))