Numbers Copied from a Website Won't Add Up in Excel? Fix Numbers Stored as Text

Published · By Sh23

You copied a table from a website, a report or Wikipedia into Excel, and =SUM() returns 0, or some rows are skipped. Most of the time the numbers came in as text. This guide shows how to spot them and how to fix them with Excel's own tools: Convert to Number, Find and Replace, and a few formulas. The Excel steps are checked against Microsoft's support articles.

Common causes at a glance

What the cell showsCauseFix
1,234 (left-aligned)Stored as textConvert to Number
1,234 with an invisible spaceNonbreaking space from the web pageSUBSTITUTE, then TRIM
1,234[1] or 1,234[a]Footnote markFind and Replace
1,500 kg, 20 USDUnit text in the cellFind and Replace
−500Minus sign character (U+2212), not a hyphenReplace − with -
500-Trailing minusFormula
(42)Accounting-style negativeReplace ( with - and remove )

First, spot numbers stored as text

Excel aligns real numbers to the right of the cell and text to the left. Numbers stored as text often also get a small green triangle (an error indicator) in the top-left corner of the cell. A quick test: select the column and look at the status bar. If it shows a Count but no Sum, Excel is not reading the cells as numbers.

When the green triangle is there, the fix is built in:

  1. Select the cells you want to fix.
  2. Select the error button that appears next to the selection.
  3. Choose Convert to Number.

This is from Microsoft's Convert numbers stored as text to numbers in Excel. If the cells also contain extra characters such as a footnote mark, a unit or a nonbreaking space, Convert to Number will not work until you remove them with the steps below.

Convert many columns at once: Paste Special > Multiply

  1. Type 1 in a blank cell formatted as General, and copy that cell.
  2. Select the numbers stored as text.
  3. On the Home tab, select the arrow under Paste, then Paste Special.
  4. Under Operation, choose Multiply, then OK. Delete the cell with the 1.

Steps from Fix text-formatted numbers by applying a number format.

Remove nonbreaking spaces (the invisible culprit)

Web pages often put a nonbreaking space (character 160) between a number and its unit, or around values to keep them on one line. It looks like a normal space but is a different character. Microsoft's TRIM function page notes that TRIM does not remove the nonbreaking space on its own. Replace it with a normal space first, then trim, then convert:

  1. Insert an empty column next to the one you want to fix.
  2. In the new column, on the same row as the first value, enter the formula below (A2 is the cell to fix).
  3. Fill the formula down.
  4. Copy the results and paste them over the original column with Paste Special > Values, then delete the helper column.
=VALUE(TRIM(SUBSTITUTE(A2, CHAR(160), " ")))

SUBSTITUTE swaps character 160 for a normal space, TRIM removes the spaces at either end, and VALUE turns the text into a number. See also Microsoft's Top ten ways to clean your data.

Use Find and Replace for footnotes, units and currency text

  1. Select only the column you want to fix, so text in other columns is not changed.
  2. Press Ctrl+H (Control+H on a Mac), or go to Home > Find & Select > Replace.
  3. In Find what, type the text to remove, for example [1] or kg. Leave Replace with empty.
  4. Select Replace All.
  5. Repeat for each mark or unit. To remove every bracketed footnote at once, search for [*]: the * is a wildcard that matches any characters.

The dialog names and the wildcard are described in Find or replace text and numbers on a worksheet. If the numbers are still left-aligned afterwards, use Convert to Number from above.

Fix negative numbers: −500, 500- and (42)

Check what the source means before you change anything; in financial tables, brackets and trailing minus signs usually mean a negative value, but read the table's notes.

What not to convert

Some values look like numbers but should stay as text. Check each column before replacing in bulk.

The leading-zero and 15-digit rules are in Keeping leading zeros and large numbers.

Copy a table from a website to Excel without the mess: SumiTable

SumiTable, a free browser extension by Sh23 (store release in preparation), lists the tables on a page. Pick one and click "For Excel / Sheets (TSV)," then paste into Excel and each value lands in its own cell. Footnote marks like [1] (including Wikipedia's reference marks), empty rows and columns, and merged cells are cleaned up before copying, and extra spaces around values are removed. Notes such as "(Unit: thousand dollars)" above or below the table are kept apart from the header row. The free version works now, up to 200 rows per table. The conversion runs on your computer, and the page content is not sent anywhere.

The free version copies the values themselves as they appear on the page, so $1,200 or (42) come through unchanged; use the steps above if Excel leaves them as text. Cleaning numbers automatically (full-width digits, currency signs, △/▲ and bracket negatives) and saving as an Excel file (.xlsx) are planned for a future paid version (Pro), which is not on sale yet. See About SumiTable.

Summary

Related