Match a Literal Asterisk in Calc SUMIF Without Summing Every Similar Code
An asterisk can be part of an identifier or an instruction to match many identifiers. Calc cannot infer which meaning you intended from the appearance of a code in a report. When a conditional sum includes too many records, inspect the criterion and the active matching rules before changing the source data.
Keep an untouched copy of the workbook. Identify the column being matched and the separate numeric column being added. Confirm that corresponding rows describe the same records; a correct text match cannot repair misaligned ranges.
Establish the matching mode
In Calc's Calculate preferences, inspect whether formulas use wildcards, regular expressions or neither. Also inspect the whole-cell matching option. The example below requires wildcards enabled and criteria applied to whole cells. Record existing settings rather than switching a working report's interpretation without reviewing its other formulas.
Under wildcard rules, an asterisk matches a sequence of characters, including an empty sequence. A tilde immediately before the asterisk makes it literal. This escape rule is specific to the wildcard mode described here; do not assume it is the equivalent regular-expression syntax.
Compare a literal code with a broad pattern
In a disposable sheet, put the text codes A*, A1 and A- into A2:A4, with the respective quantities 10, 20 and 30 in B2:B4. Enter =SUMIF(A2:A4;"A*";B2:B4). With the stated settings, the broad pattern matches all three codes and the expected result is 60.
Now compare =SUMIF(A2:A4;"A~*";B2:B4). This criterion means the literal code A*, so the expected result is 10. Inspect the matching records as well as the number. The other two rows are useful negative controls because they should be excluded from the literal result.
If a criterion comes from another cell, inspect that cell's actual contents too. The formula may be unchanged while the search instruction has changed.
Apply the agreed interpretation to the real report and reconcile a small group manually. Preserve punctuation in genuine identifiers; deleting asterisks from the source to make a formula behave would change the data's meaning. Document the criterion mode with the workbook so a later editor can reproduce the intended selection.
Reference: LibreOffice documentation.
Additional reference: Calc SUMIF syntax.