Group CSV By Column
Grouping collapses a flat export into one row per distinct value of a column. Choose the column to group by and the output lists each value once, with the number of rows that carry it. Add a sum column and every group also gets the total of a numeric field. It is the same summary people usually build with a pivot table or a SUMIF formula, produced as plain CSV.
Paste the rows or upload a file, enter the group column and, if wanted, the column to total, then copy or download the summary. The computation happens in your own tab.
Key features
- One output row per distinct value in the group column
- Row count for every group
- Optional numeric sum for one chosen column
About the CSV to grouped CSV format
The output header is the group column, then row_count, then, when a sum column is set, that column's name followed by _sum. Groups appear in the order they first show up in the input rather than alphabetically. Sort the result afterwards if you want a ranking.
Sums parse each cell as a plain decimal number. Empty sum cells add nothing to the total, but their rows still count toward row_count. A group whose sum cells are all empty reports 0.
How it works
The tool scans the rows once and keeps a running count and sum for every group key in a lookup table. When the scan ends, it writes one row per key.
Common use cases
- Counting orders per country to decide which market to review first.
- Totalling spend per customer from a line-item export.
- Checking how many records each import batch contributed to a shared table.
- Getting per-category counts from a log file before building a chart.
How to use this tool
- Paste the export, or upload the file, that you want to summarise.
- Enter the header name of the column to group by.
- Type a numeric header in the sum box to total it, or leave the box empty for counts only.
- Check the row_count and total values in the preview, then copy or download the summary.
Example
Input (five order rows)
order_id,customer,country,total
1001,Ana,Portugal,40.50
1002,Ben,Canada,12.00
1003,Ana,Portugal,19.25
1004,Chloe,France,88.00
1005,Ben,Canada,5.75Output (group by customer, sum total)
customer,row_count,total_sum
Ana,2,59.75
Ben,2,17.75
Chloe,1,88Tips for best results
- Run once without a sum column to see the group sizes, then add the sum once the grouping looks right.
- Matching is exact apart from surrounding spaces, which are trimmed. Ana and ana are two groups, so normalize capitalization in your source first.
- Pipe the summary into Sort CSV on row_count, descending, to list the busiest groups at the top.
Common errors and how to fix them
- Column "total" has a non-numeric value "$40.50" in data row 1.
- Remove the currency symbol and separators from the sum column, or clear the sum column setting for a count-only summary.
- The group-by column name is blank.
- The group field was left blank. Type the header name exactly as it appears in the first line; header matching ignores letter case.
- Output column names collide.
- The group column already has the name row_count, or it matches the generated sum header. Rename that column in the source file, then run the summary again.
Frequently asked questions
Can I group by two columns at once?
Not in one run. Build a combined key column first, for example country and city joined with a spreadsheet formula, then group by that new column.
Does the sum column accept decimals or negatives?
Yes. Totals are written with toPrecision(12), so 88.00 is shown as 88 and 0.1 + 0.2 as 0.3.
For more background on data formats and conversion workflows, read our format guides.