Average CSV Rows
Calculate row averages from CSV data. Upload or paste CSV files to compute arithmetic mean, median, min, max per column instantly.
About
Averaging rows in a CSV file sounds trivial until you encounter quoted fields containing commas, mixed delimiters, thousands of empty cells, or columns where numeric and text data coexist. A naive approach - splitting on commas and dividing - fails on real-world exports from Excel, Google Sheets, or database dumps. This tool implements an RFC 4180-compliant parser that correctly handles quoted strings, escaped double-quotes, and auto-detects the delimiter (d ∈ {, ; \t |}). For each numeric column, it computes the arithmetic mean 1n n∑i=1 xi, excluding non-numeric cells from the count. Getting this wrong means skewed reports, broken dashboards, and flawed business decisions.
The tool processes files up to several hundred thousand rows client-side using a Web Worker, so no data leaves your browser. It reports per-column mean, median, sum, min, max, and valid count. Limitation: floating-point arithmetic is IEEE 754 double-precision, so results beyond 15 significant digits will exhibit rounding. For currency data, verify that your source does not mix formats (e.g., 1,234.56 vs 1.234,56).
Formulas
The primary computation is the arithmetic mean per column. Given a column with n valid numeric values:
Where xi is the i-th valid numeric cell in the column and n is the count of cells that passed numeric validation. Non-numeric or empty cells are excluded from both the sum and the count (unless "Treat empty as zero" is enabled, in which case empty cells contribute 0 to the sum and increment n).
Median is computed by sorting all n valid values and selecting the middle element. For even n, it is the mean of the two central values.
Delimiter auto-detection counts occurrences of each candidate delimiter (, ; \t |) in the first 5 lines. The delimiter with the most consistent count across lines wins.
Reference Data
| Statistic | Symbol | Formula | Use Case | Sensitivity to Outliers |
|---|---|---|---|---|
| Arithmetic Mean | 1n∑xi | General average, revenue per row | High | |
| Median | x̃ | Middle value when sorted | Salary analysis, skewed distributions | Low |
| Sum | Σ | ∑xi | Total revenue, total units | High |
| Minimum | min | min(x1, …, xn) | Lowest price, floor detection | Extreme |
| Maximum | max | max(x1, …, xn) | Peak value, ceiling detection | Extreme |
| Count (Valid) | n | Non-empty numeric cells | Data completeness audit | None |
| Standard Deviation | σ | √∑(xi − )2n | Spread of values, quality control | High |
| Delimiter: Comma | , | ASCII 44 | Default CSV (RFC 4180) | - |
| Delimiter: Semicolon | ; | ASCII 59 | European Excel exports | - |
| Delimiter: Tab | \t | ASCII 9 | TSV files, database dumps | - |
| Delimiter: Pipe | | | ASCII 124 | Legacy systems, log files | - |
| IEEE 754 Double | - | 64-bit float | All JS arithmetic | 15 - 17 significant digits |
| RFC 4180 | - | CSV standard | Quoted fields, CRLF line breaks | - |
| Empty Cell Handling: Skip | - | Exclude from n | Sparse data, optional fields | - |
| Empty Cell Handling: Zero | - | Treat as 0 | Dense data, required fields | Lowers mean |