Free web tool

CSV top N per group

Extract the top N rows by a numeric value within each CSV group.

Input & settings

How to use

Need the top 3 products in each store or the top 5 scores in each team? This ranks rows inside each group, rather than taking one global Top N.

  1. Paste the CSV and choose the group column and numeric value column.
  2. Set Top N.
  3. Review the selected source rows, then download the CSV.

This is Top N inside each group

It does not rank Tokyo and Osaka together and then keep three rows total. It keeps up to N rows from Tokyo, up to N from Osaka, and so on. The output contains the original rows, not a summarized ranking table.

Zero is a real score

With values 0, -1, -2, the top two are 0 and -1. Blank and non-numeric values are excluded from ranking, but zero is not treated as “missing.”

Group matching is exact

Tokyo and tokyo are different groups, and so are A and A . The tool does not trim or normalize group labels. Clean the group column first if those variants should be combined.

Some groups may return fewer than N rows

If you request Top 5 but a group has only three valid numeric rows, that group returns three. Blanks and text in the value column can also reduce the number of ranked rows.

A practical clue in the output count

If the result has fewer rows than roughly groups × N, it may simply be a small group—or it may point to missing/non-numeric scores. The output count is a quick reason to inspect the source values instead of assuming every group had enough rankable data.

Want the deeper explanation?