tsvkit.org
TSV Toolkit
Sample data Say hi →

Add a Calculated Column

arithmetic across columns · round · min · max · sqrt · runs in your browser

A spreadsheet formula without the spreadsheet. Write an expression using your column names — price * qty, (revenue - cost) / cost * 100 — and get the file back with one more column on the end. Columns are read as numbers, so a cell that isn't one leaves that row blank rather than poisoning the whole file with NaN.

formula
Drop a .tsv file here, or
ready

How to use

  1. Paste or drop the file — the first row must be the header, because the header names are what the formula refers to.
  2. Write the expression. Bare words are column names: price * qty. For a name with a space, bracket it: [unit price] * qty. For a column by position, use $1, $2.
  3. Name the new column. If that name already exists the existing column is overwritten in place — that's how you recalculate one.
  4. Set the decimals if you want a fixed number of places. Leave it blank to keep the full result.

What the expression language supports

Operators + - * / % (remainder) and ^ (power), with normal precedence and parentheses. Unary minus works. Functions: abs, round(x) or round(x, places), floor, ceil, trunc, sqrt, pow(a, b), min(a, b, …), max(a, b, …), log (natural), log10, exp.

Column names are matched exactly first, then case-insensitively, so Price finds a price column if there is no exact match. There are no string functions, no conditionals and no aggregates — this computes one row at a time from that row's own values. For totals across rows use group and aggregate; for anything conditional, compute the raw number here and then filter.

How cells become numbers

Before evaluation, each referenced cell is trimmed and has spaces, commas and underscores removed, then parsed. So 1,234.50, 1 234.5 and 1234.5 all read as the same number. What does not parse: currency symbols, percent signs, parenthesised negatives like (500), and European decimal commas. Run the file through clean numbers first if it came out of a finance system — that tool exists precisely for this handoff.

An unparseable cell yields NaN, which propagates through the arithmetic and lands in the output as whatever you chose under if it fails. Blank is the default because it is honest: it says "no result for this row" rather than the lie that zero tells. Division by zero produces infinity, which is treated the same way. The status line counts these rows so you know how many there were.

FAQ

How do I compute a percentage change between two columns?

(new - old) / old * 100, with decimals set to 1 or 2. Rows where old is zero divide by zero and come out blank, which is correct — percentage change from zero is undefined, and a zero there would be a fabricated number.

Can I use the new column in a second formula?

Yes — copy the output back into the input box and run again. The second pass sees the column you just added, so subtotal * 1.2 works once subtotal exists. Chaining passes is also how you get around the lack of conditionals.

Why does my result have a long floating-point tail?

0.1 + 0.2 is 0.30000000000000004 in every language that uses IEEE-754 doubles, this one included. Set decimals to the precision you actually want. For money, compute in integer cents where you can — see round numbers for tidying an existing column.

Is the expression evaluated with eval()?

No. It's parsed by a small recursive-descent parser into a tree of arithmetic operations — the only names it can resolve are your column names and the listed functions. Nothing from the page or the browser is reachable from an expression.

Privacy

100% client-side. No upload. See the privacy policy.