TheLibreOffice.com

Named Ranges in LibreOffice Calc: Define, Use and Audit Them

Define a named range, prove which cells it uses, and include new records in the result. Covers scope, SUM and INDEX, text references, heading-based names, and workbook audits.

Name a cell range. A green label marks a selected block of cells.

To create a named range in LibreOffice Calc, select the cells and choose Sheet → Named Ranges and Expressions → Define. Check the address, choose the scope, and use the new name in a formula such as =SUM(SalesAmount). I'd start with a document-wide name and an absolute reference: that gives a shared total one clear definition before you add more sheets or data.

Choose a named range for the job

A name gives a cell range a readable reference; it doesn't decide what calculation to perform or which future rows belong to it. You can name one cell, several cells, or a formula expression. For this guide, start with an ordinary fixed range and a total you can check by hand.

You needUseCheck
A readable reference in a formulaSheet → Named Ranges and Expressions → DefineAddress, scope, and absolute references
Several column names from headingsSheet → Named Ranges and Expressions → CreateSelected border and generated names
A table with sorting, filtering, or import settingsData → Define RangeDatabase range and its label/options settings
A specific area on the printed pageFormat → Print Ranges → DefinePrint preview and page count

The Calc guide distinguishes ordinary names from database ranges. Both can identify cells, but a database range also stores settings for database operations. Keep that distinction in mind when following instructions written for an Excel table.

Define SalesAmount and check its total

Use a new practice workbook with a sheet named Sheet1. Enter this small set of numbers:

CellEnter
B1Amount
B210
B320
B430
  1. Select B2:B4, leaving the heading out.
  2. Choose Sheet → Named Ranges and Expressions → Define.
  3. Enter SalesAmount in Name.
  4. Check that Range or formula expression reads $Sheet1.$B$2:$B$4.
  5. Choose Document (Global) for Scope.
  6. Click Add, then OK if the dialog remains open.

In D2, enter =SUM(SalesAmount). In E2, enter =SUM(B2:B4). Both should return 60. Change B3 from 20 to 25: both should become 65. Restore B3 to 20 before continuing.

This checks the calculation and its dependency on the intended cells. A plausible-looking total by itself doesn't tell you which range the formula uses. The Define Names dialog exposes the address and scope together, which is why I prefer it for the first name in a workbook.

Audit the name, the exact address and the scope together.

Define Name with SalesAmount, the absolute B2:B4 reference on Sheet1, and Document (Global) scope.
Define SalesAmount as $Sheet1.$B$2:$B$4 with Document (Global) scope; the Amount heading stays outside the range. View this interface detail at full size.

Use the Name Box for a quick definition or jump

For a faster definition, select the cells, click the Name Box at the left of the formula bar, type an unused valid name, and press Enter. Then inspect the result in Sheet → Named Ranges and Expressions → Manage. The Name Box is also a navigation tool: choose an existing range name from its list to select that range.

Typing an existing name can take you to its cells. To change an existing definition, use the manager rather than treating the Name Box as a replacement editor. Names for formula expressions aren't necessarily listed there; use Manage for the full definition check.

Calc Name Box showing SalesAmount while B2:B4, containing 10, 20 and 30, is selected.
Choose SalesAmount in the Name Box to select B2:B4. Check the highlighted cells rather than relying on the name alone. View this interface detail at full size.

Check the name, address, and scope separately

These three fields solve different problems. A name can be valid while pointing to the wrong cells, and an accurate address can still belong to a scope you didn't intend.

  • Name: use letters, numbers, and underscores, beginning with a letter or underscore. SalesAmount and Sales_Amount work as clear labels. Spaces aren't allowed.
  • Reserved forms: don't use cell addresses such as A1, the single names C or R, or names beginning with C or R followed by a number. These restrictions are in Calc's range-naming rules.
  • Address: keep $Sheet1.$B$2:$B$4 for this shared input block. The dollar signs fix the sheet, columns, and rows against relative changes when a formula is copied.
  • Scope: Document (Global) makes the name valid across the workbook. Selecting a sheet gives it that sheet's scope. Check this field when a formula works on one sheet but fails or resolves differently on another.

Scope doesn't change which cells the address contains. A global name can point to a small range on Sheet1; it doesn't include the same coordinates on every sheet. For a shared workbook, I'd avoid giving identical spellings different meanings on several sheets. Distinct names such as ActualSales and BudgetSales make the choice visible in the formula.

Absolute references also need a precise interpretation. They resist changes caused by copying a formula; they don't freeze the workbook's structure. Calc can adjust absolute and relative addresses when rows or columns move. Inspect the definition after a structural edit.

Use SUM for the range and INDEX for one value

For the original three-cell definition, these formulas ask different questions:

On a narrow screen, scroll this table sideways to read each complete formula and its expected result.

FormulaRequestExpected result
=SUM(SalesAmount)Add the numeric values in the range60
=INDEX(SalesAmount;1;1)Return the first row, first column within the range10
=INDEX(SalesAmount;2;1)Return the second row, first column within the range20

INDEX positions are relative to the named block: its row 1 is worksheet row 2 in this example. The INDEX reference explains the row and column arguments. Supplying both makes the requested single cell explicit.

Typing only =SalesAmount doesn't mean “sum this range.” In an ordinary non-array formula, Calc can use implicit intersection: the formula's position selects an intersecting value, or produces an error when there is no suitable intersection. Use SUM for the total and INDEX for a specific element.

The examples use English function names and semicolons between arguments. If your installation uses localized function names or another separator, follow its formula settings. Don't change the range definition to repair a function-name or separator error.

A single named cell can hold a shared input

Enter 10% in G2 and name that cell TaxRate, using the same Define dialog and document scope. With the original SalesAmount total of 60, =SUM(SalesAmount)*TaxRate gives 6. A percentage cell holds 0.1 here; entering the number 10 would multiply the total by ten.

Keep a reusable input in a visible cell when colleagues need to change it. A name can also represent a formula expression, but that calculation belongs in Range or formula expression without an initial equals sign. The naming help describes this separate feature; the fixed cell-range example doesn't need it.

Use a global name in VLOOKUP from another sheet

For a separate practice example, create a sheet named Catalog. In A2:B4, enter three ID/price pairs: P100 and 10, P200 and 20, then P300 and 30. Define ProductPrices as $Catalog.$A$2:$B$4 with Document (Global) scope. On a different sheet, put P200 in A2 and enter =VLOOKUP(A2;ProductPrices;2;0) in B2. The expected result is 20.

For this global definition, use ProductPrices directly: the stored address already identifies Catalog. The final 0 requests an exact VLOOKUP match. Change A2 to P999; the expected result is #N/A, which shows that a missing ID hasn't silently selected a lower-priced row. If Calc reports an unknown name, inspect the saved definition and scope in Manage before changing the lookup formula.

If a cell contains the name as text

Suppose H2 contains the text SalesAmount. Then =SUM(H2) sees that cell's text; it doesn't follow the text to the named range. =SUM(INDIRECT(H2)) asks Calc to interpret the text as a reference and should return 60 for the original block. The INDIRECT function provides that conversion.

I'd use =SUM(SalesAmount) directly unless the workbook needs a user-selectable range. Text-based references add another spelling and dependency to audit, and INDIRECT recalculates whenever recalculation occurs. For lookup tables, the range name can occupy the table argument in a VLOOKUP formula; a cell containing that name as text needs the same distinction.

Make new rows part of the calculation

Add 40 in B5. If SalesAmount still refers to B2:B4, =SUM(SalesAmount) remains 60. The new value is outside its definition. To include it deliberately:

  1. Open Sheet → Named Ranges and Expressions → Manage.
  2. Select SalesAmount and extend its expression to $Sheet1.$B$2:$B$5.
  3. Confirm the change. Check that D2 now returns 100.
  4. Change the direct comparison formula in E2 to =SUM(B2:B5). It should also return 100.
Manage Names with SalesAmount extended through B5 and Document (Global) scope.
Extend the saved SalesAmount endpoint to B5 in Manage Names when the new 40 belongs in the total; changing cells alone does not change the definition. View this interface detail at full size.

That last step matters: two formulas that still agree on the old three cells don't prove that either includes the fourth amount.

Inserting a row and typing below the range are different actions

Calc's General settings include Expand references when new columns/rows are inserted, under Tools → Options → LibreOffice Calc → General. On macOS, start with LibreOffice → Preferences.

This setting concerns inserted rows or columns adjacent to a reference, with at least two cells in the direction being expanded. Inserting inside a referenced area expands it regardless of that setting. Simply typing or filling data into cells below the area isn't the same insertion operation. After either workflow, reopen Manage and check the actual endpoint.

For a recurring list, another straightforward choice is to reserve a dedicated input block, for example B2:B1000, and define the name over that block. A SUM then includes later numeric entries placed inside it, including entries after an internal blank. Keep headings, unrelated numbers, and totals outside the block, and set a capacity that fits your list. The endpoint still needs extending when the list reaches it.

A dynamic formula-based reference is an option for more complex models. Functions such as OFFSET can return a resized reference, but the rule that finds the last record must match the data. A count of filled cells isn't automatically the position of the last record when there are gaps. I'd use an explicit or reserved range for this total before adding that maintenance burden.

Create several names from headings

For a separate example, put Units in J1 and UnitPrice in K1, with data underneath through row 4. Select J1:K4, then choose Sheet → Named Ranges and Expressions → Create and select Top row. Confirm the dialog.

The resulting names should refer to J2:J4 and K2:K4; the headings supply the names and are excluded from the data ranges. The Create Names options also support the left column, bottom row, and right column. Choose the border that holds your labels.

Inspect the generated definitions in Manage before using them. Duplicate headings can overwrite a generated name, and a heading with spaces or punctuation may not produce the identifier you expected. For manual names, selecting the data without its heading and defining it explicitly avoids that ambiguity.

Column labels in an Excel-style expression such as Orders[Amount] belong to a different setup: a database table range and its field names. An ordinary named rectangle doesn't acquire those fields merely because its first row contains headings. Calc's database table reference rules also warn that saving structured references to ODS converts them to direct references. Check that behavior separately from an ordinary name such as SalesAmount.

Audit definitions before renaming or deleting them

Use Sheet → Named Ranges and Expressions → Manage to inspect a name's expression, scope, and range options. The Manage Names command can modify definitions and delete selected names. Before a structural change, save a copy of the workbook and note which formulas depend on the name.

For a readable list of definitions, add a blank audit sheet, select A1, and choose Sheet → Named Ranges and Expressions → Insert. In the Paste Names dialog, click Paste All. Paste All lists names and their cell references at the cursor, so give it empty space. Use Manage to check scope as well; regenerate the audit list after changing definitions.

Renaming or deleting a definition needs a dependency check, not just a glance at the cells it used to describe. Reopen affected formulas on other sheets, check their references, and change a known input. Deleting a name removes its definition; clearing the cells is a separate action. If a change breaks a dependent formula, undo it or repair that dependency before saving the working copy.

SymptomCheck first
A name is rejectedSpaces, first character, cell-address lookalikes, and reserved C/R forms
A formula reports an unknown nameSpelling, scope, existence of the definition, and localized function names
A range returns one value or an intersection errorUse SUM for the total or INDEX with explicit row/column arguments
New amounts don't change the totalThe saved range endpoint; verify the new rows are included
A text-based selection doesn't choose a rangeThe cell contains text; inspect the need for INDIRECT and its exact spelling
Two totals agree but omit a recordBoth may reference the old endpoint; compare against the complete intended input block

To print the cells of an ordinary named range, select it through the Name Box, then choose Format → Print Ranges → Define. The print-range controls set the area that prints or exports; preview the pages before sending them. Naming the range alone doesn't set the page layout.

Keep an ODS master for the editable workbook. If someone needs XLSX, save a separate copy and reopen it in the receiving application. Check definitions and scope, inspect formulas, and change one sample input to confirm the intended dependency. The Calc and Excel compatibility guide covers the wider handoff.

My final check is whether the next person can find the cells behind the name and prove that the newest record participates in the result. Clear names help them read the formula. Correct definitions and a reopened file make that formula useful.

Filed under Calc