SmartQueryTools

Count Values in CSV Files Online

Group and count rows by any column in CSV files directly in your browser. Sort by frequency or value to find the most common entries — no upload required.

How to count Values in CSV files

  1. Drop your file onto the upload area. The row count is shown and the first column is pre-selected.
  2. Choose a column in the Group by column list.
  3. Pick a sort order: Count (high → low), Count (low → high) or Value (A → Z).
  4. Click Count. The result has two columns, value and count, and the heading shows how many distinct values were found.
  5. Click Download to save the counts in the same format you uploaded, with _countby added to the file name.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Worked example

A city bike-share scheme wants to know which docking stations trips start from most often. A few trips from a faulty dock have no start station recorded.

Input (CSV)

trip_id,start_station,duration_min,rider_type
5001,Quay St,12,member
5002,Park Rd,25,casual
5003,Quay St,8,member
5004,,17,casual
5005,Quay St,31,casual
5006,Park Rd,9,member

Settings

  • Group by column: start_station
  • Sort by: Count (high → low)

Result

valuecount
Quay St3
Park Rd2
NULL1

Six trips collapse to three groups. Quay St has three trips, Park Rd two, and the trip with no station forms its own group with a null value. Missing values are counted, not dropped, so the counts always add up to the total row count. The output columns are always named value and count, whatever the source column was called.

Working with CSV files

Grouping is exact, so the CSV text must match character for character. "Quay St", "Quay St." and "quay st" are three different groups, and so is "Quay St " with a trailing space. When a frequency table shows near-identical labels one or two rows apart, clean the column with Trim Whitespace or Convert Case and count again.

Types are detected before counting, and that can merge values you think of as different. In a column of all-digit codes such as postcodes, 02134 and 2134 are both read as the number 2134 and land in the same group. Empty fields are grouped together as one null row. The downloaded CSV has the header value,count, and the null group is written as an empty value followed by its count. The sort choice matters most for long frequency tables. Count (low → high) puts rare values at the top, which is where typos and one-off codes usually show up.

Frequently Asked Questions

Why does my CSV count show the same label twice?

The two labels differ in a way that is hard to see, usually a trailing space or a change in letter case. Trim and standardise the case of the column, then count again.

How are empty CSV fields counted?

All empty fields in the column form a single group with an empty value. It sorts like any other group when you order by count.

Can I count by more than one column?

No. The tool groups by one column. For combinations of columns, use the Aggregate tool or the SQL Query tool with GROUP BY on several columns.

How are ties ordered when sorting by count?

Values with the same count have no fixed order between them. Choose Value (A → Z) if you need a stable, alphabetical order.

Does the on-screen table show every value?

The on-screen table shows the first 500 groups. The heading still gives the full number of distinct values, and the downloaded file contains every group.

Related Tools