# Working with Imperial Linear Distances

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Working with Imperial Linear Distances.

Peter asked if it was possible in Excel to create a custom number format that will deal with imperial linear distances, such as inches, feet, miles, etc. The short answer is that no, this is not possible. Excel works natively in the decimal system, and many imperial measuring systems are based on other numeric systems (feet on base 12, for instance). While custom formatting can change the way that numbers are displayed, it cannot perform the conversions necessary for imperial measurements.

Your best bet is to keep the different units of whatever imperial measurement you want in different cells. For instance, a distance of 3 miles, 428 feet, and 7 inches could be kept in three cells, one for miles, one for feet, and the other for inches. You could then write the formulas necessary to convert to whatever measurement system you desire. There are also Excel add-ins available around the Internet (a quick search will find them) that can allow you to use this technique to work with linear measurements.

Another approach is to develop a custom function or macro that would convert a value into a linear measurement and display it as text. You couldn't use the result in math functions, but it may give you want you want for your workbook. Consider, for example, the following simple macro:

```Function N2MYFI(x) As String
Dim x1 as Long

x1 = x
Distances = Array(63360, 36, 12, 1)

For Each Item In Distances
x1 = x1 - Item * Int(x1 / Item)
Next

End Function
```

This function returns four numbers, in a string, that represent the number of miles, yards, feet, and inches (MYFI) in a raw value. It is assumed that the value fed to the function is in inches, such as the following:

```=N2MYFI(100)
```

This returns the string "0 2 2 4", which means there are 0 miles, 2 yards, 2 feet, and 4 inches in 100 inches. The function could easily be changed to return the values in any format desired.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3137) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Working with Imperial Linear Distances.

Related Tips:

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

 *Name: Email: Notify me about new comments ONLY FOR THIS TIP Notify me about new comments ANYWHERE ON THIS SITE Hide my email address *Text: *What is 5+3 (To prevent automated submissions and spam.)

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)

# Our Company

Sharon Parq Associates, Inc.

# Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Excel Products

Word Products

# Our Authors

Author Index

Write for Tips.Net