GETPIVOTDATA Function (LibreOffice Calc)
Retrieve LibreOffice pivot results by field and item names. Follow a complete four-record example and distinguish pivot totals from raw-data aggregation.
Verification status: Eight conditional GETPIVOTDATA examples were checked using exact aggregation and LibreOffice 26.8 Help plus the 26.8.1.1 callback. No pivot object or native formula was executed. Downstream pivot lookup, numeric-item formatting and GUI behavior remain untested. How formula examples are checked
Quick answer: With the pivot layout specified below, GETPIVOTDATA("Sales";$E$1;"Region";"East") addresses the East total, 30. The 30 is an independently calculated reference for that assumed pivot; no native pivot was created or queried.
Availability and version history
- Introduced: First release and earliest historical documentation not established in the retained evidence.
- Supported in: 26.8 Help and 26.8.1.1 registration; no retirement is established.
- Scope: Desktop Calc with English semicolon-separated formulas. The examples assume an existing, unfiltered pivot with the stated totals.
- Checked: October 14, 2026. Function-specific Help, the complete callback and independent aggregation examples were checked. No pivot object, GUI setup or native GETPIVOTDATA formula was executed.
What GETPIVOTDATA does
GETPIVOTDATA retrieves a result from an existing pivot table by its data-field and item names. It does not build a pivot table from an arbitrary source range. Help explains that addressing names can survive layout changes, provided the reference still identifies the intended pivot and the requested result remains available.
A requested subtotal must actually be available under the pivot’s configuration. The function should not be treated as a general SUMIFS substitute over hidden raw records. Filters, displayed items and subtotal settings affect the results that the pivot exposes. Function Help.
Syntax and arguments
GETPIVOTDATA(TargetField; PivotReference [; Field1; Item1 [; Field2; Item2 ...]])
Square brackets mark optional trailing arguments; do not type them. TargetField is the source data-column name or its displayed data-field caption, such as “Sales” or the exact displayed sum caption. PivotReference is a reference inside the intended pivot table. Each optional Field/Item pair adds a condition. Supply complete pairs; the inspected callback requires at least two arguments and an even argument count. The examples use text items and one unambiguous pivot anchor.
Worksheet setup
Use this source data in A1:C5:
| Region | Product | Sales |
|---|---|---|
| East | Pen | 10 |
| East | Book | 20 |
| West | Pen | 30 |
| West | Book | 40 |
Create an actual pivot with Region as the row field, Product as the column field and Sales summarized by SUM. Include both row and column grand totals and all four source records, with no filter hiding them. Place the pivot so E1 is inside its output. Do not substitute a manually typed summary for the pivot object. The resulting mathematical cross-tab is:
| Region | Book | Pen | Total |
|---|---|---|---|
| East | 20 | 10 | 30 |
| West | 40 | 30 | 70 |
| Total | 60 | 40 | 100 |
Worked formula checks
These references follow the exact pivot setup above. They are independent aggregation checks, not saved application results.
| Formula | Conditional mathematical reference | Required pivot result |
|---|---|---|
=GETPIVOTDATA("Sales";$E$1) |
100 | The available grand total. |
=GETPIVOTDATA("Sales";$E$1;"Region";"East") |
30 | The displayed East row total. |
=GETPIVOTDATA("Sales";$E$1;"Region";"West") |
70 | The displayed West row total. |
=GETPIVOTDATA("Sales";$E$1;"Product";"Pen") |
40 | The displayed Pen column total. |
=GETPIVOTDATA("Sales";$E$1;"Product";"Book") |
60 | The displayed Book column total. |
=GETPIVOTDATA("Sales";$E$1;"Region";"East";"Product";"Pen") |
10 | The East/Pen intersection. |
=GETPIVOTDATA("Sales";$E$1;"Region";"West";"Product";"Book") |
40 | The West/Book intersection. |
=GETPIVOTDATA("Sales";$E$1;"Product";"Book";"Region";"East") |
20 | The same complete conditions can be listed in the opposite field order. |
Practical use
Build and inspect the specified pivot before entering the retrieval formulas elsewhere in the sheet. The independently calculated grand total is 10+20+30+40=100. East contributes 30 and West contributes 70. The Pen and Book column totals are 40 and 60. These checks help distinguish a wrong field/item reference from an unexpectedly filtered pivot.
Use a single anchor cell inside the intended pivot. If the output moves, update that anchor as needed. Avoid a broad reference covering several pivot tables: Help describes a selection rule, while the callback delegates table selection to an uninspected document helper. This guide does not certify which table wins an ambiguous reference.
Advanced interpretation and checks
If a report needs a percentage, first retrieve the numerator and the appropriate total with explicit field conditions. For the unfiltered example, East’s share is 30/100=0.3 and East/Pen’s share of East is 10/30=1/3. State the denominator’s meaning; a product share, regional share and whole-table share answer different questions. These ratios are independent arithmetic, not extra native pivot observations.
Calc also documents a legacy two-argument syntax with the pivot reference first and a constraint string second. The callback selects it when there are exactly two arguments and the first is a reference. It parses legacy subtotal-function qualifiers but does not pass the parsed function list to the final GetPivotData call; its comment says those qualifiers are currently ignored. Prefer explicit field/item pairs and do not rely on legacy function qualifiers without separate verification.
Boundaries and troubleshooting
Official Help says field/item order is immaterial and names are case-insensitive. It also describes how filter selections and available subtotals restrict matches. Those downstream lookup details were not executed here. All example names use the same case as the source and all requested totals are explicitly included in the assumed layout.
The callback reports a reference error when it cannot find a pivot at the supplied reference, cannot parse legacy constraints, or receives a NaN result from the pivot lookup. The complete pivot-object lookup implementation was not retained, so this guide does not assign an exact error to every possible missing or ambiguous item. Date/numeric item formatting, GUI creation and refresh behavior remain untested. Refresh and inspect the pivot before relying on it to represent changed source records.
Related functions
Official evidence and checking scope
The source is LibreOffice 26.8.1.1. Its callback constructs field filters, selects a pivot object and delegates the actual lookup. The underlying pivot-object helper, legacy constraint parser, GUI creation and refresh were not exercised. Conditional example totals must not be mistaken for native execution.