Contact

LibreOffice Calc ยท Ranges and names ยท Intermediate

Create and Maintain Named and Database Ranges in LibreOffice Calc

Define scoped formula names and database record ranges in Calc, extend each explicitly, and verify totals and retained sort settings. Compare #Data, #Totals and #All selectors without double-counting.

Documentation-qualified; native workflow and save/reopen checks pending ยท Editorial standards

Use a named range for readable formulas and a database range for a rectangular set of records with retained data-operation settings. They solve different maintenance problems: a name can simplify a formula without defining the table you intend to sort.

Before you start

Use a disposable ODS workbook with sheets named Budget, Review, and Stock. These standard-menu instructions follow Calc Guide 26.2 (February 2026) and the online Help labeled 26.8, consulted 19 October 2026. The examples and arithmetic were independently checked; no native Calc run or screenshots are claimed. Save/reopen checks below are checks for you to perform.

1. Give a formula range an explicit scope

On Budget, enter this table in A1:B4:

Cost Amount
Materials 120
Delivery 35
Packaging 15
  1. Select B2:B4 and choose Sheet โ†’ Named Ranges and Expressions โ†’ Define.
  2. Set Name to PlanCosts, the range to $Budget.$B$2:$B$4, and Scope to Document (Global). Click Add.
  3. On Review, enter =SUM(PlanCosts) in B2. Expected: 170.
  4. Back on Budget, define LocalCosts for the same range, but select Budget as its scope. Enter =SUM(LocalCosts) in D2 on Budget. Expected: 170.
  5. Open Sheet โ†’ Named Ranges and Expressions โ†’ Manage. Check both names, absolute addresses, and scopes. The document-wide name is the one to use for this workbook’s cross-sheet report; the sheet-local name is intentionally confined to Budget. Avoid duplicate names with different scopes until you need that complexity.

The Define Names help describes the scope and reference controls. Use simple identifiers such as these, without spaces or cell-address-like names.

2. Extend the name deliberately

Enter Handling in A5 and 10 in B5. Inspect PlanCosts in Manage: a reference ending at B4 does not include B5. For that reference, Review.B2 remains 170. Edit its end address to $B$5, confirm the dialog, and verify 180. LocalCosts still points at B2:B4 and should remain 170.

As a change test, change B3 from 35 to 40: the two sums should now be 185 and 175. Restore B3 to 35: 180 and 170. This proves which cells each name includes; a plausible total alone does not.

If your edition adjusts a range automatically, inspect its address first rather than assuming either expansion or non-expansion. To recover the exercise, set the references explicitly to the stated addresses and retest.

3. Define a separate record block

On Stock, enter A1:C4:

SKU Depot Units
K11 West 8
K12 East 5
K13 West 12

Select A1:C4. Choose Data โ†’ Define Range, name it StockRecords, and inspect $Stock.$A$1:$C$4. Expand Options; enable Contains column labels, leave Contains totals row off, then Add โ†’ OK. This local fixture has no linked external database.

Use Data โ†’ Select Range to select StockRecords. Choose Data โ†’ Sort, with column labels and top-to-bottom direction, and sort Units descending. Expect complete rows in SKU order K13, K11, K12. Reopen Define Range and inspect the range’s Operations information for Sort. Database ranges retain operation settings; they are not simply alternative formula names. These controls and the Modify workflow are documented in Calc Guide 26.2, Chapter 15.

4. Grow and recheck the record block

Enter a fourth record in row 5: K14, East, 20. Reopen Define Range, select StockRecords, and inspect its Range field. Set it explicitly to $Stock.$A$1:$C$5; click Modify โ†’ OK. Select the range again and repeat the Units-descending sort. Expected SKU order: K14, K13, K11, K12; expected units total: 45.

Do not use Insert or delete cells as proof of automatic growth for manually typed rows. The guide describes that option in connection with linked external data. Check the address and operation settings whenever a table grows. Define Range help identifies the available options.

5. Create several names from column headers

For a separate exercise in this same disposable workbook, add a sheet named Headers and enter A1:B4:

ActualUnits PlannedUnits
6 8
9 10
4 7

First inspect Sheet โ†’ Named Ranges and Expressions โ†’ Manage and confirm neither name already exists. Use these unique, simple labels; duplicate labels can overwrite names. Select A1:B4, including the header row. Choose Sheet โ†’ Named Ranges and Expressions โ†’ Create. Enable only Top row, clear the other border choices, and confirm.

The Calc Guide chapter’s Create Names section documents this command and the exclusion of header cells. Reopen Manage and inspect the results: ActualUnits should refer to $Headers.$A$2:$A$4, and PlannedUnits to $Headers.$B$2:$B$4. Check scope there too; this exercise uses the resulting names on Headers itself and does not rely on an assumed cross-sheet scope.

On Headers, enter =SUM(ActualUnits) in D2 and =SUM(PlannedUnits) in D3. Expected: 19 and 25. Change A3 from 9 to 11: D2 should become 21, while D3 remains 25. Restore A3 to 9, then verify 19 and 25 again. Neither header belongs in its numeric range; inspect the addresses rather than relying only on a sum that ignores text.

If the names or boundaries differ, undo the creation before doing more edits and check the selected rectangle and Top row setting. Do not keep rerunning Create over existing names. This is a shortcut for creating ordinary names, not for creating database ranges or promising automatic extension when records are appended. Save and reopen the ODS practice copy and inspect both names, boundaries and totals again. The additional workflow follows Calc Guide 26.2, checked 22 October 2026, for the free desktop application; native execution remains pending.

6. Compare database selectors without counting totals twice

This separate, documentation-based exercise uses the free desktop application. The fixed Calc Guide 26.2 chapter, published February 2026, supplies the range-definition workflow; Database Table Reference Help, currently labeled 26.8, supplies selector syntax and prerequisites. Both were checked 28 October 2026. The moving latest Help URL is not a claim about your installed version. No native selector execution is claimed.

Use a fresh, unsaved disposable workbook, separate from the ODS exercises above, with a sheet named Selectors. Enter this one-column table in A1:A5; the final cell must contain the formula, not a typed 25:

Cell Entry
A1 Units
A2 8
A3 5
A4 12
A5 =SUM(A2:A4)

Select A1:A5, choose Data โ†’ Define Range, and use the unused name StockParts. Inspect $Selectors.$A$1:$A$5. Expand Options, enable both Contains column labels and Contains totals row, then Add โ†’ OK. This is a vertical database range with a simple valid column label, not an ordinary named expression. A5 is the bottom row of the definition; its formula adds only the three records.

Enter these formulas outside the range. A single keyword takes one pair of brackets; retain the database name.

Cell Formula Selected cells Expected sum
C2 =SUM(StockParts[#Data]) A2:A4: records only 25
C3 =SUM(StockParts[#Totals]) A5: total only 25
C4 =SUM(StockParts[#All]) A1:A5: header, records and total 50

50 is the deliberate double-counting trap, not the record total: SUM ignores the text header but adds both 25 from the records and 25 from A5. Change A3 from 5 to 7. A5 should become 27, and C2:C4 should read 27, 27, 54. Restore A3 to 5 and check 25, 25, 50 again. These are independently calculated expectations, not observed Calc results.

For a controlled failure, with the restored inputs reopen Define Range, select StockParts, clear only Contains totals row, and choose Modify โ†’ OK. Help specifies that #Totals without a defined totals row produces #REF!; A5 now belongs to the records, so the expected C2/C4 sums are 50/50. Restore that checkbox through Modify โ†’ OK, retain A1:A5, and recheck 25, 25, 50. If the controls or results differ, stop and record the actual build, range, flags and formula text; do not replace an error with a fixed total. Any unperformed check remains Not tested.

Do these checks before saving. For format choice and subsequent handoff checks, follow Check structured references before choosing ODS; this selector exercise does not establish persistence or migration success.

Recovery and final check

The following ODS checks concern the earlier Budget, Review, Stock and Headers exercises, not the separate selector workbook.

  • A missing name or unexpected total: inspect spelling, scope, and the reference before changing the formula.
  • A SKU paired with the wrong depot or units: undo the sort immediately, select the entire block, and repeat. A total of 45 cannot detect separated record fields.
  • Save, close, and reopen the ODS. Recheck PlanCosts = 180, LocalCosts = 170, both scopes, StockRecords ending at C5, and the retained Sort information.
  • Keep this as ODS. CSV cannot preserve this workbook’s multiple sheets and range definitions. These earlier exercises do not test cross-format portability; use the linked migration checks for the separate selector workbook.

For a practical use of a formula name, see a drop-down list from another sheet. Review SUM for the total calculation.