Sub topic 9
Naming Ranges to Make Formulas Readable
Prerequisites and the purpose of named ranges
You should already know how to enter formulas, select cell ranges, and use basic functions such as SUM and AVERAGE. You should also understand A1 notation, where a reference such as B2:B10 identifies cells from B2 through B10.
A named range is a saved name for a cell or range of cells. Instead of writing B2:B10 in every formula, you can give that range a name such as MonthlySales. The name makes the formula easier to read and reduces mistakes when the range is used repeatedly.
For example, these formulas calculate the same result:
=SUM(B2:B10)=SUM(MonthlySales)The second formula tells you what the values represent without requiring you to inspect column B.
Creating and using a named range
To create a named range in Google Sheets:
- Select the cells you want to name.
- Open Data > Named ranges.
- Enter a name, such as
MonthlySales. - Select Done.
A named range normally uses a name without spaces. Use an underscore when you need to separate words, such as January_Sales. The name must not look like a cell reference, such as A1, and it should describe the data rather than its current location.
You can use the name anywhere a range reference is accepted.
=SUM(MonthlySales)
=AVERAGE(MonthlySales)
=MAX(MonthlySales)-MIN(MonthlySales)You can also combine a named range with other references:
=SUM(MonthlySales)*$F$1Here, MonthlySales identifies the values being totaled, while $F$1 identifies a fixed rate or multiplier.
Choosing useful names
Good names describe the meaning or role of the data:
| Range | Useful name | Possible formula |
|---|---|---|
| `B2:B100` | `ProductPrices` | `=AVERAGE(ProductPrices)` |
| `D2:D100` | `OrderTotals` | `=SUM(OrderTotals)` |
| `F2:F13` | `TaxRates` | `=MAX(TaxRates)` |
Avoid names such as ColumnB or Range1. Those names describe location, so they become confusing when the sheet changes.
A named range is not automatically a dynamic range. If you define OrderTotals as D2:D100, adding a value in D101 does not necessarily extend the named range. Edit the named range when the intended data area changes. For data that grows regularly, define the range with extra rows or use an open-ended range such as D2:D.
Checking and updating names
Open Data > Named ranges to review, rename, or change the range behind a name. When you change the range, formulas using that name update without requiring you to edit each formula.
This creates a useful separation:
flowchart TD
A[Named range: OrderTotals] --> B[Current range: D2:D100]
B --> C[Formula: SUM(OrderTotals)]
B --> D[Formula: AVERAGE(OrderTotals)]caption: How one named range connects several formulas to the same data. alt: A named range points to a cell range, and two formulas use the named range.
If you delete the cells or range that a named range refers to, formulas may show #REF!. Reopen the named-range panel and point the name to a valid range. If a formula shows #NAME?, check the spelling and confirm that the named range still exists.
Exercise
A range named ServiceFees refers to C2:C50. Write a formula that adds all service fees and explain one benefit of using the name.
Show answer
Use =SUM(ServiceFees). The formula is easier to read than =SUM(C2:C50), and changing the range definition updates formulas that use the name.