Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Converting to Octal.
Written by Allen Wyatt (last updated October 26, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021
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 (5656) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Converting to Octal.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
Users of the most recent versions of Excel have four different ways available to combine values into strings. Even those ...
Discover MoreExcel includes a surprising number of functions you can use to round your data. Two such functions are FLOOR and CEILING, ...
Discover MoreThe UNIQUE function can be used to evaluate a range and return the unique values in that range. Understanding how the ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2024-10-26 10:23:35
JMJ
A famous octal joke: Why is oct 31st the Xmas of geeks? Because 31OCT=25DEC!
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments