PERCENTOF Function in Gnumeric: Formula, Examples, and Troubleshooting
Return the ratio of numeric subset totals to the complete numeric dataset.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in Gnumeric. How formula examples are checked
Quick answer: =PERCENTOF(subset,data_all) sums numeric values in the subset range and divides by the numeric sum of data_all. It returns a fraction, which can be displayed as a percentage. With a subset total of 400 and full total of 550, the expected value is 0.7272727273, displayed as 72.73% when percentage formatting is applied.
Exact syntax, argument order, and version
=PERCENTOF(subset,data_all)
| Argument | Expected type | Required? | Meaning |
|---|---|---|---|
subset |
A cell range or numeric array | Yes | Values to count toward the numerator. They do not have to be contiguous with the full range, provided the selected cells represent the intended subset. |
data_all |
A cell range or numeric array | Yes | Values to sum for the denominator/total. |
There are exactly two required arguments in the release registration (AA); no optional defaults are indicated. Gnumeric 1.12.62 newly introduces this function. The official release’s implementation explicitly ignores blank cells, text and boolean cells in its numeric collecting step, propagates input errors encountered by collection, and returns #DIV/0! if the total sum is zero. This is different from treating the count of rows as the denominator.
These formulas use a comma argument separator and decimal points for English-language examples. Gnumeric parsing and localized display may vary with installed locale; consult the Formula Entry settings/help if a pasted expression is rejected.
Reproduce a sales share in Gnumeric
- Add the following sample data to A1:B7. Column A contains labels; column B contains numeric sales amounts.
- Put
=PERCENTOF(B2:B4,B2:B7)into an empty result cell. - Format that result as a percentage with two decimal places, or retain the unformatted numerical fraction.
| Row | A: Region | B: Sales |
|---|---|---|
| 1 | Region | Sales |
| 2 | East | 120 |
| 3 | West | 80 |
| 4 | East | 200 |
| 5 | North | 100 |
| 6 | West | 0 |
| 7 | East | 50 |
=PERCENTOF(B2:B4,B2:B7)
Expected result: 400 / 550 = 0.7272727273 (approximately 72.73%).
Explanation: B2:B4 has 120 + 80 + 200 = 400. B2:B7 has 120 + 80 + 200 + 100 + 0 + 50 = 550. The ratio is a share of sales, not a count of records. A percentage display multiplies the displayed value by 100; the underlying formula still yields a fraction.
Advanced scenario: a noncontiguous subset built from criteria
The previous subset was selected by row position. A category such as East appears in nonadjacent rows. To form a safe, auditable subset without assuming that PERCENTOF filters labels, create a helper column C:
- Set C1 to
East sales. - Enter
=IF(A2="East",B2,0)in C2 and fill down through C7. - Check that C2:C7 reads
120, 0, 200, 0, 0, 50. - Calculate:
=PERCENTOF(C2:C7,B2:B7)
Expected result: 370 / 550 = 0.6727272727, displayed as 67.27%. This separates the definition of the subset from the ratio operation. When you append rows, extend both the helper and total ranges to include the newly added transactions. For a fixed, small sample, the simpler alternative is =SUMIF(A2:A7,"East",B2:B7)/SUM(B2:B7); the numerical arithmetic is equivalent, but this does not prove any non-Gnumeric application’s PERCENTOF syntax.
Errors, unexpected totals, and troubleshooting
#DIV/0!: The Gnumeric 1.12.62 implementation deliberately returns this error when the numerical sum ofdata_allis zero. The error can occur even if rows exist but all eligible numeric values total zero. Correct the denominator; don’t hide the failure if a zero total is meaningful.- A value above 100%: The calculation does not independently verify that
subsetreally lies insidedata_all. An unrelated or overlapping subset can sum to more than the total; audit the ranges before treating the ratio as a share. - Zeros from imported data: Text numerals or blank cells can be ignored by the collector. Convert intended amounts to real numeric cells and verify
SUMof both inputs. - Booleans in data ranges: The examined code uses
COLLECT_IGNORE_BOOLS, not conversion of TRUE to 1 for this function. Don’t treat checkboxes as financial amounts. - Errors in source cells: The function’s collector returns an error when a referenced value is an error. Examine and fix the original cell rather than asserting one universal error code for every input type.
- Wrong percentage: Entering
=100*PERCENTOF(...)and then using percent formatting multiplies the display again. Choose either percentage formatting on the fraction or multiply by 100 for a plain-number display. - Unrecognized function name: Confirm version 1.12.62 and the math plugin. The older web-based function index may lag new functions introduced in this release.
Excel and other spreadsheet compatibility
Microsoft 365 Excel independently documents PERCENTOF(data_subset,data_all) with the same numerical ratio. This does not imply that all older Excel, LibreOffice, OpenOffice or Numbers versions have a directly named equivalent. The common alternative =SUM(subset)/SUM(data_all) works wherever matching SUM and range references are supported. Excel for Microsoft 365 offers PERCENTOF; verify the target release rather than assuming it is universal. Spreadsheet import/export may rewrite or reject a function absent in the destination application.
Related Gnumeric tutorials
Function-specific documentation
The Gnumeric 1.12.61 → 1.12.62 math source diff contains its two-argument source registration (AA), help text, collection flags excluding strings/bools/blanks and explicit #DIV/0! zero-sum guard. The official announcement names PERCENTOF among newly added functions. The source diff is a third-party mirror of the tagged official release, and the packaged official source archive is linked for owner review.
Official reference and verification
Verification status: Official documentation checked; example outcomes were independently reasoned or arithmetically checked where applicable. Not executed in Gnumeric.
- No genuine Gnumeric screenshots are included; this guide does not use mock application images.