SmartQueryTools

Add Calculated Column to CSV Files Online

Add a new column to CSV files computed from an arithmetic expression over existing columns. No formulas, no code — just point and click.

How to add Calculated Column to CSV files

  1. Drop your file onto the upload area. It is loaded into the in-browser engine and the first 200 rows are shown.
  2. Type a name for the new column. The default is "calculated".
  3. Build the expression. Pick a column or "constant" on the left, choose an operator (+, −, ×, ÷ or %), then pick a column or constant on the right. The two sides start on the first and second columns of the file.
  4. Click Calculate. The new column is added as the last column and the preview updates.
  5. Download the result in the same format you uploaded.

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 hardware shop exports its stock count and wants the value of stock on the shelf for each product line: units counted multiplied by unit cost. One line was not counted this week.

Input (CSV)

sku,item,units,unit_cost
HW-101,Wood screws 4x40 (box),38,4.25
HW-102,Brass hinge pair,12,7.5
HW-103,Wall plugs (100),0,2.75
HW-104,Masking tape 24mm,,3.25
HW-105,Sandpaper P120 (10),25,5.75

Settings

  • New column name: stock_value
  • Expression: units × unit_cost

Result

skuitemunitsunit_coststock_value
HW-101Wood screws 4x40 (box)384.25161.5
HW-102Brass hinge pair127.590
HW-103Wall plugs (100)02.750
HW-104Masking tape 24mmNULL3.25NULL
HW-105Sandpaper P120 (10)255.75143.75

Each row multiplies its own units by its own unit_cost, and the result is appended as stock_value. Wall plugs have a real count of 0, so their value is 0. Masking tape has no count at all, so its value is NULL, not 0: any arithmetic with a NULL operand gives NULL. Run Fill Empty Values first if a blank count should be treated as zero.

Working with CSV files

CSV stores everything as text, so the engine guesses each column's type when the file loads. A column only works in the expression if it was read as a number. Values such as "1,200", "$45.00" or "12%" keep the column as text, and the calculation stops with a type error naming the operator. Strip the symbols with Find & Replace, or convert the column with Cast Column Types, then run the calculation again. A column with only whole numbers loads as an integer type, and one with any decimal point loads as a double.

Empty fields load as NULL, so rows with a blank operand get a blank result rather than a zero. The new column is written at the right-hand end of each line in the downloaded CSV. Results are written at full floating-point precision, so a division such as 10 ÷ 3 appears as 3.3333333333333335. Add a Round Numbers step before you download if the file is going to people rather than into another program.

Frequently Asked Questions

Why does my CSV calculation fail with "No function matches"?

One of the chosen columns was loaded as text, usually because some values contain a currency symbol, a thousands separator or a stray word such as "n/a". Clean those values or cast the column to a number, then calculate again.

Can I subtract two date columns in a CSV?

Yes, if both columns load as dates (ISO format such as 2026-07-06 is detected automatically). Date minus date gives the number of days as a whole number. For hours, months or years use Date Difference instead.

Can I use more than two operands or brackets in one expression?

No. Each run applies one operator to two operands, which can be columns or constants. Every run starts from the file you uploaded, so to chain steps, download the result, drop it back in and calculate again. For longer formulas, use the SQL Query tool.

What happens if I divide by zero?

The calculation does not stop. Rows where the divisor is zero get an empty (NULL) result, for both ÷ and %, whatever the column types. Every format writes it the same way, as an empty value.

How does the % operator work?

It is modulo, the remainder after division, not percent. 17 % 5 gives 2, and the sign follows the left operand, so -5 % 3 gives -2. To get a percentage, divide one column by another, then multiply the result by the constant 100 in a second run.

Related Tools