Spreadsheet Practice

Why does VALUE return #VALUE! for numbers with units?

Formula (Excel and Google Sheets)

=VALUE(SUBSTITUTE(A2," kg",""))

VALUE can't read letters. Remove the unit first: =VALUE(SUBSTITUTE(A2," kg","")).

Result on the example
one result per row in B2, filled down to B6
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.

How it works

VALUE converts text that looks like a number, but "12.5 kg" has letters in it, so it returns #VALUE!. SUBSTITUTE removes " kg" first, leaving "12.5", which VALUE turns into a real number. The thousands separator in "1,250" is fine.

=VALUE(SUBSTITUTE(A2," kg",""))

Result12.5

  1. A2"12.5 kg"

    The value in A2.

  2. SUBSTITUTE(A2," kg","")"12.5"

    SUBSTITUTE: Replaces matching text.

    • textA2"12.5 kg"
    • old_text" kg"
    • new_text""
  3. VALUE(SUBSTITUTE(A2," kg",""))12.5

    VALUE: Converts text that looks like a number into a number.

    • textSUBSTITUTE(A2," kg","")"12.5"

In Google Sheets

The same formula works in Google Sheets: =VALUE(SUBSTITUTE(A2," kg","")). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=--SUBSTITUTE(A2," kg","")12.5, 8, 0.75…The double minus converts like VALUE.
=VALUE(TEXTBEFORE(A2," "))Excel only12.5, 8, 0.75…Excel 365: keeps whatever comes before the first space, so any unit works.

Common mistakes

  • SUBSTITUTE is case-sensitive: " KG" or " kgs" stay in the text. Nest another SUBSTITUTE, or take the text before the space.
  • Text with a comma as the decimal separator ("12,5") depends on your settings. NUMBERVALUE takes the separators as arguments: =NUMBERVALUE("12,5",",").

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Why does VALUE return #VALUE! for numbers with units

In B2, turn the weight text into a number you can add up. Fill down to B6.

Questions

How do I pull the number out of any text in Google Sheets?

=VALUE(REGEXEXTRACT(A2,"[0-9.,]+")) takes the first run of digits.

How do I show the unit again after a calculation?

Join it to the result: =SUM(B2:B6)&" kg".

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.