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: Converting to Octal.

Converting to Octal

Written by Allen Wyatt (last updated February 27, 2021)
This tip applies to Excel 97, 2000, 2002, and 2003


There are four types of numbering systems commonly used in programming: binary, octal, decimal, and hexadecimal. Each is simply a different method of expressing the exact same values. Excel makes it easy to convert between decimal and octal numbers, and provides two worksheet functions for that very purpose.

The first function is the DEC2OCT function. Suppose you have a decimal value in cell B7, and you want to know how to express that value in octal. In a different cell you could use the following formula:

=DEC2OCT(B7)

If the value in B7 was 456, the result of the above formula would be 710. An interesting fact (and potential "gottcha") is that when the conversion is completed, Excel considers the result to be a number. Thus, if you added 8 to the resulting value above (710), Excel would return 718—a value impossible in octal. This simply means that Excel doesn't keep track of the numbering system used in a particular cell; it expects you to do that.

If you want to convert numbers back the other way, from octal to decimal, you can use the OCT2DEC worksheet function:

=OCT2DEC(B8)

If you try to use this function with a value that is clearly not octal (such as 718), then Excel returns a #NUM! error value.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2316) 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: Converting to Octal.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Grabbing the MRU List

Want to use the list of most recently used files in a macro? You can access it easily by using the technique presented in ...

Discover More

Choosing SUBSTITUTE or REPLACE

If you need to modify information in a text string, two common functions you can use are SUBSTITUTE and REPLACE. This tip ...

Discover More

Finding Text in Text Boxes

Want to search for text that may appear in a text box rather than in a regular worksheet cell? You can only perform the ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Numbers in Base 12

Different professions use numbers in entirely unique ways. You may need to come up with a number that represents the ...

Discover More

Converting Strings to Numbers

When working with data in a macro, there are two broad categories you can manipulate: numbers and text. Sometimes you ...

Discover More

Iterating Circular References

Does your data require that you perform calculations using circular references? If so, then you'll want to be aware of ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 0?

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


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.