Excel CONVERT function

CONVERT turns a number from one unit code into another. It is built into Excel. It does not use this site's catalogue: a unit with no code needs the formula on its quantity page.

The formula

Microsoft's example =CONVERT(1, "lbm", "kg") converts one pound-mass to kilograms.

=CONVERT(number, from_unit, to_unit)

Case

Codes and prefixes are case-sensitive. Pa is the pascal. PA returns #N/A. lbm is not LBM. M is mega and m is milli, so MPa and mPa are different units.

Prefixes

A prefix can be prepended to any metric unit. Microsoft's table spells deka as dekao. The codes are da and e. A prefix multiplies the unit as written. It does not raise a power: cm3 is a hundredth of a cubic metre, not a cubic centimetre, and km2 is 1,000 square metres, not a square kilometre. For an area, convert each side.

Prefix Multiplier Code
yotta 10^24 Y
zetta 10^21 Z
exa 10^18 E
peta 10^15 P
tera 10^12 T
giga 10^9 G
mega 10^6 M
kilo 10^3 k
hecto 10^2 h
deka 10 da or e
deci 10^-1 d
centi 10^-2 c
milli 10^-3 m
micro 10^-6 u
nano 10^-9 n
pico 10^-12 p
femto 10^-15 f
atto 10^-18 a
zepto 10^-21 z
yocto 10^-24 y

Bit and byte also take binary prefixes. An unsupported prefix returns #N/A.

Binary prefix Value Code
kibi 2^10 ki
mebi 2^20 Mi
gibi 2^30 Gi
tebi 2^40 Ti
pebi 2^50 Pi
exbi 2^60 Ei
zebi 2^70 Zi
yobi 2^80 Yi

Square feet to square metres

Microsoft's example converts 100 square feet by converting each side. The result is 9.290304 square metres.

=CONVERT(CONVERT(100,"ft","m"),"ft","m")

Errors

  • #N/A when the code is unknown, the prefix is not allowed, or the two units are in different groups. =CONVERT(2.5, "ft", "sec") returns #N/A. =CONVERT(1, "bar", "psi") returns #N/A because bar is not a code.
  • #VALUE! when the number is not numeric. =CONVERT("bar", "kPa", "psi") returns #VALUE!.

Unit codes

These are the from_unit and to_unit values Microsoft documents. The Prefix column is Yes when a prefix from the table can be prepended. Microsoft does not publish that flag. Yes follows the metric SI units, including the ones in Microsoft's own examples (kilogram, kilometre, centimetre, litre). Do not prefix Celsius, Fahrenheit, Rankine or Réaumur.

Weight and mass

Unit Codes Prefix
Gram g Yes
Slug sg No
Pound mass (avoirdupois) lbm No
Atomic mass unit u Yes
Ounce mass (avoirdupois) ozm No
Grain grain No
US hundredweight cwt or shweight No
Imperial hundredweight uk_cwt, lcwt or hweight No
Stone stone No
Ton (US, 2,000 lb) ton No
Imperial ton uk_ton, LTON or brton No

Distance

Unit Codes Prefix
Metre m Yes
Statute mile mi No
Nautical mile Nmi No
Inch in No
Foot ft No
Yard yd No
Angstrom ang Yes
Ell ell No
Light-year ly Yes
Parsec parsec or pc Yes
Pica (1/72 inch) Picapt or Pica No
Pica (1/6 inch) pica No
US survey mile survey_mi No

Time

The second takes a prefix, so ms is a millisecond. Minute, hour, day and year do not.

Unit Codes Prefix
Year yr No
Day day or d No
Hour hr No
Minute mn or min No
Second sec or s Yes

Pressure

at is another name for the standard atmosphere, not the technical atmosphere. Prefer Pa. The code p is also the pico prefix.

Unit Codes Prefix
Pascal Pa or p Yes
Standard atmosphere atm or at No
Millimetre of mercury mmHg No
Pound-force per square inch psi No
Torr Torr No

Force

Unit Codes Prefix
Newton N Yes
Dyne dyn or dy Yes
Pound-force lbf No

Energy

Unit Codes Prefix
Joule J Yes
Erg e Yes
Thermodynamic calorie c Yes
IT calorie cal Yes
Electronvolt eV or ev Yes
Horsepower-hour HPh or hh No
Watt-hour Wh or wh Yes
Foot-pound flb No
BTU BTU or btu No

Power

Unit Codes Prefix
Horsepower HP or h No
Pferdestärke PS No
Watt W or w Yes

Magnetism

Unit Codes Prefix
Tesla T Yes
Gauss ga Yes

Temperature

Do not put a prefix on C, F, Rank or Reau.

Unit Codes Prefix
Degree Celsius C or cel No
Degree Fahrenheit F or fah No
Kelvin K or kel No
Degree Rankine Rank No
Degree Réaumur Reau No

Volume

A prefix on m3 multiplies the cubic metre. cm3 is 0.01 cubic metres, not a cubic centimetre.

Unit Codes Prefix
Teaspoon tsp No
Modern teaspoon tspm No
Tablespoon tbs No
Fluid ounce oz No
Cup cup No
US pint pt or us_pt No
UK pint uk_pt No
Quart qt No
UK quart uk_qt No
Gallon gal No
UK gallon uk_gal No
Litre l, L or lt Yes
Cubic angstrom ang3 or ang^3 Yes
US oil barrel barrel No
US bushel bushel No
Cubic foot ft3 or ft^3 No
Cubic inch in3 or in^3 No
Cubic light-year ly3 or ly^3 Yes
Cubic metre m3 or m^3 Yes
Cubic mile mi3 or mi^3 No
Cubic yard yd3 or yd^3 No
Cubic nautical mile Nmi3 or Nmi^3 No
Cubic pica Picapt3, Picapt^3, Pica3 or Pica^3 No
Gross registered ton GRT or regton No
Measurement ton MTON No

Area

A prefix on m2 multiplies the square metre. km2 is 1,000 square metres, not a square kilometre.

Unit Codes Prefix
International acre uk_acre No
US survey acre us_acre No
Square angstrom ang2 or ang^2 Yes
Are ar Yes
Square foot ft2 or ft^2 No
Hectare ha No
Square inch in2 or in^2 No
Square light-year ly2 or ly^2 Yes
Square metre m2 or m^2 Yes
Morgen Morgen No
Square mile mi2 or mi^2 No
Square nautical mile Nmi2 or Nmi^2 No
Square pica Picapt2, Pica2, Pica^2 or Picapt^2 No
Square yard yd2 or yd^2 No

Information

Bit and byte take the binary prefixes. A decimal prefix such as k or M also works. Any other prefix returns #N/A.

Unit Codes Prefix
Bit bit Binary
Byte byte Binary

Speed

Unit Codes Prefix
Admiralty knot admkn No
Knot kn No
Metre per hour m/h or m/hr Yes
Metre per second m/s or m/sec Yes
Mile per hour mph No

Codes this site maps

Each quantity page marks our units with an Excel code, or a dash when CONVERT has none. kN/m2 and N/mm2 have no code, even though they equal kPa and MPa. The technical atmosphere at is not Excel's at. A numerically equal unit with a different name, such as a stock-tank barrel or a standard cubic foot, is not given the other unit's code.

Google Sheets

Google Sheets has CONVERT and many of the same codes, and it has LAMBDA. Named functions are created under Data > Named functions, not Formulas > Name Manager. A code that works in Excel can return #N/A in Sheets, so try a known value before you rely on it.