O'Reilly logo

Excel Scientific and Engineering Cookbook by David M Bourg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.8. Converting Units

Problem

You want to convert a number from one unit to another directly within Excel.

CLEAN

Figure 3-15. CLEAN

Solution

Use Excel's built-in worksheet function CONVERT. Alternatively, you can write your own conversion function.

Discussion

The sections below describe hoe to use CONVERT, how to write your own conversion function (or other functions), and how to create an add-in to make your own collection of functions accessible from any spreadsheet.

Using CONVERT

The Analysis ToolPak add-in included in Excel contains a worksheet function called CONVERT that allows you to convert values from one unit to another. To use CONVERT, you must ensure the Analysis ToolPak is installed in your version of Excel. To do this, select Tools → Add-Ins ... from the main menu bar to open the Add-Ins dialog box. Select Analysis ToolPak from the list of available add-ins and then press OK.

The syntax for CONVERT is =CONVERT(cell reference , from units , to units ), where cell reference is a valid cell reference, from units is a string indicating the units of the value being converted, and to units is a string indicating the units to which the value is being converted.

Valid strings for units are listed in the Excel help topic "Convert." You can find this topic by searching for "Convert" in Excel's online help, or you can browse this topic starting from the help table of contents (look for the topic ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required