WorksheetFunction.Convert(Object, Object, Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Converts a number from one measurement system to another. For example, Convert can translate a table of distances in miles to a table of distances in kilometers.
public:
double Convert(System::Object ^ Arg1, System::Object ^ Arg2, System::Object ^ Arg3);
public double Convert (object Arg1, object Arg2, object Arg3);
Public Function Convert (Arg1 As Object, Arg2 As Object, Arg3 As Object) As Double
Parameters
- Arg1
- Object
The value in from_units to convert.
- Arg2
- Object
The units for number.
- Arg3
- Object
The units for the result. Convert accepts the following text values (in quotation marks) for from_unit and to_unit which are listed in the Remarks section below.
Returns
Remarks
Gram | "g" |
Slug | "sg" |
Pound mass (avoirdupois) | "lbm" |
U (atomic mass unit) | "u" |
Ounce mass (avoirdupois) | "ozm" |
Meter | "m" |
Statute mile | "mi" |
Nautical mile | "Nmi" |
Inch | "in" |
Foot | "ft" |
Yard | "yd" |
Angstrom | "ang" |
Pica (1/72 in.) | "Pica" |
Year | "yr" |
Day | "day" |
Hour | "hr" |
Minute | "mn" |
Second | "sec" |
Pascal | "Pa" (or "p") |
Atmosphere | "atm" (or "at") |
mm of Mercury | "mmHg" |
Newton | "N" |
Dyne | "dyn" (or "dy") |
Pound force | "lbf" |
Joule | "J" |
Erg | "e" |
Thermodynamic calorie | "c" |
IT calorie | "cal" |
Electron volt | "eV" (or "ev") |
Horsepower-hour | "HPh" (or "hh") |
Watt-hour | "Wh" (or "wh") |
Foot-pound | "flb" |
BTU | "BTU" (or "btu") |
Horsepower | "HP" (or "h") |
Watt | "W" (or "w") |
Tesla | "T" |
Gauss | "ga" |
Degree Celsius | "C" (or "cel") |
Degree Fahrenheit | "F" (or "fah") |
Kelvin | "K" (or "kel") |
Teaspoon | "tsp" |
Tablespoon | "tbs" |
Fluid ounce | "oz" |
Cup | "cup" |
U.S. pint | "pt" (or "us_pt") |
U.K. pint | "uk_pt" |
Quart | "qt" |
Gallon | "gal" |
Liter | "l" (or "lt") |
The following abbreviated unit prefixes can be prepended to any metric from_unit or to_unit.
exa | 1E+18 | "E" |
peta | 1E+15 | "P" |
tera | 1E+12 | "T" |
giga | 1E+09 | "G" |
mega | 1E+06 | "M" |
kilo | 1E+03 | "k" |
hecto | 1E+02 | "h" |
dekao | 1E+01 | "e" |
deci | 1E-01 | "d" |
centi | 1E-02 | "c" |
milli | 1E-03 | "m" |
micro | 1E-06 | "u" |
nano | 1E-09 | "n" |
pico | 1E-12 | "p" |
femto | 1E-15 | "f" |
atto | 1E-18 | "a" |
If the input data types are incorrect, Convert generates an error.
If the unit does not exist, Convert generates an error.
If the unit does not support an abbreviated unit prefix, Convert generates an error.
If the units are in different groups, Convert generates an error.
Unit names and prefixes are case-sensitive.