Groupgrain

Original examples

Small tables.
Visible decisions.

Every example uses one exact text key column and one different decimal column. Header record 1 is not counted as data.

Craft lengths and a negative adjustment

Category,Length
Ribbon,1.25
Cord,2.5
Ribbon,0.75
Cord,-0.5
Tape,0

Select column 1 for the key and column 2 for the value. Ribbon has two records and an exact sum of 2. Cord also has two records and sum 2, because 2.5 − 0.5 = 2. Tape contributes one record and zero. The grand count is 5 and the grand sum is 4. Zero values are counted; the negative number is an adjustment, not a missing record.

A quoted comma and exact tenths

Label,Amount
"Blue, wide",0.1
"Blue, wide",0.2
Red,-0.3

The comma inside the quoted label belongs to one field. The first group key is the text Blue, wide, with count 2 and exact decimal sum 0.3. Red has count 1 and sum −0.3. The grand sum is exactly zero across three records. No binary floating-point residue is rounded away.

Quotes and a multiline key

Key,Value
"A""B",2
"Line
Break",-1.5
"A""B",0.25

The doubled quote decodes to one quote, so the first and last data records share key A"B and sum to 2.25. The middle key includes a line break and sums to −1.5. There are three data records even though the text occupies five physical lines after the header. The grand sum is 0.75. The notes JSON-escape that embedded line break.

Keys that look related remain separate

Key,Value
A,1
a,2
 A,3
,4
A,5

The result has four groups in first-appearance order: "A" totals 6 across two records; "a" totals 2; " A" totals 3; and the empty key totals 4. The leading space is retained. All five data records contribute, so the grand sum is 15. This is exact grouping, not automatic cleanup.

Blank and duplicate header labels

Key,Key,
red,ignore,1.000000000001
red,ignore,-0.000000000001

Select key position 1 and numeric position 3. Position 2 has the same header name as position 1, and position 3 has a blank name, but their numbered choices are distinct. The only group, red, has count 2 and exact sum 1. Choosing position 2 as the numeric value would correctly reject ignore; the tool does not infer which column you intended.

Formula-like and prototype-like keys are text

Key,Value
=SUM(A1:A2),1
__proto__,2
constructor,3
=SUM(A1:A2),-0.5

The first key stays literal text and totals 0.5 across two records. The next keys total 2 and 3. Their grand sum is 5.5 across four records. No formula, object prototype lookup or HTML markup is executed. Text and JSON exports preserve the keys; they are not spreadsheet files.

A bad record stops the result

For Key,Value followed by A,, the selected value is blank and calculation fails. For a row ending in a third comma-separated field, the record width differs from the two-column header and reading columns fails. Neither case quietly drops the record or turns it into zero.

Paste an example into Groupgrain, press Read columns, select positions, then Calculate totals. The guide describes every dialect limit, exact comparison rule and complete-report behaviour.