Sub topic 9
Named ranges as an alternative to absolute references
This chapter assumes you can write relative, absolute, and mixed references, and that you know how a formula changes when you fill it down. It shows how a defined name can replace a $E$1-style reference.
Why use a name instead of dollar signs
An absolute reference such as $E$1 works, but it tells the reader nothing. In =B2*$E$1, you must look at E1 to learn that it holds a tax rate. A defined name gives the cell a label you choose. If E1 is named TaxRate, the formula becomes:
D2: =B2*TaxRateBoth formulas return the same result. The name behaves as an absolute reference by default, so filling the formula down keeps pointing at E1. You do not need to type dollar signs or press F4.
Create a name
You have three common ways to define a name.
- Select the cell (E1), click the Name Box left of the formula bar, type
TaxRate, and press Enter. - Select the cell, then use Formulas > Define Name and fill in the name and the cell it refers to.
- Select a label and its value together, then use Formulas > Create from Selection. Excel takes the name from the label.
Names follow a few rules:
- They must start with a letter, an underscore, or a backslash.
- They cannot contain spaces. Use
Tax_RateorTaxRate. - They cannot look like a cell address, so
Q1andA1are rejected. - They are not case sensitive.
taxrateandTaxRateare the same name.
You can see and edit all names in Formulas > Name Manager.
Use a name in a formula
Type the name directly, or start typing it and pick it from the autocomplete list. You can also use Formulas > Use in Formula. Here is a complete example with a named rate and a named range of prices.
| Cell | Content |
|---|---|
| E1 | 0.08 (named `TaxRate`) |
| B2:B10 | Prices (named `Prices`) |
| C2 | `=B2*TaxRate` |
| E3 | `=SUM(Prices)` |
C2: =B2*TaxRate
E3: =SUM(Prices)Here B2 is still a normal relative reference, so it shifts as you fill down. TaxRate does not shift. Names can mix with ordinary references freely.
Scope: workbook or worksheet
A name has a scope. By default it is workbook scoped, so every sheet can use it. This removes the need for the sheet prefix you saw in Rates!$B$1:
C2: =B2*TaxRateIf TaxRate is defined at workbook scope, this formula works on any sheet and points at the same cell. You can also limit a name to one sheet by choosing that sheet in the Scope box of the New Name dialog. Two sheets can then each have their own TaxRate. A sheet-scoped name used from another sheet needs the prefix, for example Sheet2!TaxRate.
Avoid giving a sheet-scoped name the same name as a workbook-scoped one unless you want that override. On the sheet with the local name, the local one wins, and this can confuse readers.
How names behave on copy, move, and insert
- Copy and fill: A name always points at the same cells, so it does not shift. This matches
$E$1. - Cut and paste the named cell: The name follows the cell to its new location.
- Insert or delete rows: The name adjusts, as an absolute reference does. If you insert a row above E1,
TaxRatenow points at E2. - Delete the named cell: Formulas using the name show
#REF!, and Name Manager shows#REF!as the target.
A name does not make a range expand. Prices always covers B2:B10 until you edit it. If you add a price in B11, SUM(Prices) misses it unless you redefine the name or use an Excel Table.
Names and mixed references
A name refers to a fixed cell or range. It cannot replace a mixed reference like $A2 or B$1, because those depend on where the formula sits. The multiplication table formula =$A2*B$1 still needs its dollar signs. Likewise, the running total =SUM($B$2:B2) needs one end of the range to be relative.
Use names for fixed inputs: rates, thresholds, constants, and lookup tables. Keep mixed references for patterns that change across rows and columns.
Trade-offs
| Aspect | `$E$1` | `TaxRate` |
|---|---|---|
| Readability | You must look at the cell | Meaning is clear |
| Typing | F4 toggles dollar signs | Needs a defined name |
| Finding the cell | Visible in the formula | Needs Name Manager or Name Box |
| Risk | Missing `$` gives wrong results | Typos give `#NAME?`, which is easy to spot |
A misspelled name returns #NAME?, which is loud. A missing dollar sign returns plausible but wrong numbers. This is a real advantage of names for fixed inputs.
The cost is hidden location. A reader must open Name Manager to find the cell. Use clear names and keep named inputs on a visible assumptions area.
Exercises
Exercise
The formula =B2*TaxRate is filled from D2 down to D20. TaxRate is defined as E1. What does the formula in D5 refer to, and why?
Show answer
D5 contains =B5*TaxRate. The relative B2 shifts down three rows to B5. The name TaxRate keeps pointing at E1, because a defined name behaves as an absolute reference.
Exercise
A multiplication table uses =$A2*B$1 in B2. Can you replace both references with names? Explain.
Show answer
No. A name points at a fixed cell or range, but this formula needs the column locked on A and the row locked on 1 while the other part moves. Mixed references depend on the formula's position, so the table still needs the dollar signs.