Excel CONVERT Function Made Easy

Do you ever use the Excel CONVERT function? Do you avoid it, because you can't remember all the measurement unit codes?
For example, the formula =CONVERT(10,"klt","gal") will convert 10 kilolitres to 2,641.7205 gallons – if you get those codes right.
You might be able to remember lt and gal, but probably not many of the other codes.

Drop Down Lists of Units

To make the CONVERT function easy to use, I created an Excel file, with lists of the unit categories, codes and the prefixes.
First, you'll select a conversion type, from a drop down list of unit categories.
convertfunction01
Then, enter a quantity.
convertfunction02b
Next, you can select a prefix, if applicable, from a drop down list.
convertfunction02
And select the unit type, from the next drop down list. This list only shows the items for the Conversion Type that you selected. The instructions for this technique can be found on the Dependent Data Validation From a Sorted List page.
convertfunction03

Select the Conversion Units

After you have selected the starting unit type, select the prefix and units for the converted quantity.
In this example, we're converting kilolitres to gallons, and you can see the CONVERT function unit codes at the right of the unit names.
convertfunction04

See the Converted Quantity

In the final cell, a formula checks for entries in the From and To unit cells, then converts the quantity. It uses the quantity, prefix codes, and unit codes.
=IF(COUNTA(D10,D14)<2,"", CONVERT(D6,E9&E10,E13&E14))
convertfunction05

Excel VBA Code Clears Cells

You can use this workbook without macros, but if you enable macros, the data entry cells will be cleared, when you select a Conversion Type.
To see the event code that clears the cells, right-click on the sheet tab, and click View Code.
convertfunction06

Download the Excel CONVERT Function Workbook

To test the CONVERT function, and see how the data validation drop down lists work, you can download the sample file from the Contextures website. Go to the Excel Sample Files page, and in the Functions section, look for: FN0022 CONVERT Function Made Easy.
The file is in Excel 2007/2010 format, and zipped. It contains a macro, so enable macros if you want to automatically clear the data entry cells.
NOTE: The Conversion sheet is protected, with no password.
_________________

0 thoughts on “Excel CONVERT Function Made Easy”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.