This is a small javascript tool that only does one simple thing: sum values in a given column of data.
There are an infinite number of ways to do this, of course, but I got tired of firing up calculators, command-lines, or spreadsheet software when I already have a browser window open.
- Live search (results update as you type)
- Works offline (just clone or download this repository and open
index.html
in any browser) - Online demo available
- Display total number of values summed (useful for calculating averages)
- Advanced options: specify field separator and field to sum
Enter data in the Input box. All non-numeric data is stripped and the values to be summed are shown in the Sum values column on the right.
Click the Calculate sum button to update the result field at the bottom of the page.
The advanced options are revealed by clicking the corresponding checkbox below the result field.
Two options can be specified: Field separator and Field to sum.
Entering a character or string in the Field separator box identifies it as a delimiter, and the text in the Input box will be split into columns wherever this delimiter occurs. For example, the Field separator is initially set to \t
by default, which means that columns will be separated by tabs. Setting the Field separator to ,
would split the input text at commas.
The value in the Field to sum box should specify the number of the column to summed after the input data has been split by the string in the Field separator box. So, for example, the initial value of 2
means that the values in the second column would be used. This can be useful if you have several columns of data and only want to sum one of them (as in a spreadsheet program).
"Sum columns" is part of the tiny tools series.
Other small tools for working with columns of data that might also be of interest:
- milligram CSS by @cjpatoilo, prototyped using dropin-minimal-css
- github-corners by @tholman
MIT.