OCT2DEC function
Converts an octal number such as "755" to decimal (493). A 10-digit value starting with 4–7 is read as negative.
Available in Excel 2007 and later (Excel 2003 needed the Analysis ToolPak add-in), Microsoft 365, Excel for the web, Excel for Mac
Excel 2007 and laterWorks in Google Sheets
Syntax
OCT2DEC(number)| Argument | What it means | |
|---|---|---|
number | Required | The octal number to convert, as text or a number. At most 10 characters (30 bits): -536,870,912 to 536,870,911. A 10-character value whose first digit is the highest one is read as negative (two's complement). |
Returns: A decimal number (which can be negative).
How OCT2DEC works
OCT2DEC turns an octal (base-8) value into a normal decimal number. Each position is worth eight times the one to its right, so 755 is 7×64 + 5×8 + 5 = 493. You will mostly meet octal in Unix file permissions and in older computing and avionics documentation (aircraft transponder squawk codes are octal digits too).
Inputs can be up to 10 octal digits (30 bits). A 10-digit input whose first digit is 4 or more is negative in two's complement, so 7777777533 returns -165. Any digit 8 or 9 makes the input invalid and returns #NUM!.
Examples
1Permission code to decimal
| A | B | |
|---|---|---|
| 1 | Octal | |
| 2 | 755 | 493 |
Result: 493
7×64 + 5×8 + 5 = 448 + 40 + 5 = 493.
2Read a negative two's-complement value
| A | B | |
|---|---|---|
| 1 | Octal | |
| 2 | 7777777533 | -165 |
Result: -165
The input is 10 digits and starts with 7, so the sign bit is set and Excel returns -165.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | The input contains 8 or 9, is longer than 10 characters, or is otherwise not octal. | Check the source; a value with 8 or 9 is decimal, not octal. |
Tips
- Octal values typed as numbers lose leading zeros; that does not change the result, but store them as text if you want to see them.
- For values longer than 10 digits, use
=DECIMAL(A2, 8).
Google Sheets
OCT2DEC also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
OCT2DEC in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | OKT.TIL.DEC |
| Dutch | OCT.N.DEC |
| Finnish | OKTDES |
| French | OCTDEC |
| German | OKTINDEZ |
| Hungarian | OKT.DEC |
| Italian | OCT.DECIMALE |
| Norwegian (Bokmål) | OKTTILDES |
| Polish | ÓSM.NA.DZIES |
| Portuguese (Brazil) | OCTADEC |
| Portuguese (Portugal) | OCTADEC |
| Russian | ВОСЬМ.В.ДЕС |
| Spanish | OCT.A.DEC |
| Swedish | OKT.TILL.DEC |