# How to use the DEC2OCT function

The DEC2OCT function converts a decimal number to a octal number.

##### What is a decimal number?

The decimal system is a positional numeral system that uses 10 as the base, it requires 10 different numerals: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The dot or the decimal point represents decimal fractions which are not whole numbers.

The decimal number 520 has three positions, each with a different weight. It starts with 10^0 on the right and increases by one power on each additional position to the left.

520 = (**5***10^2)+(**2***10^1)+(**0***10^0)

520 = 500 + 20 + 0

##### What is a octal number?

The octal system is a number system with a base of 8 that uses the digits 0, 1, 2, 3, 4, 5, 6 and 7. The octal system is often used in electronics because it is easy to perform a conversion between octal and binary numbers.

Decimal |
Octal |

0 | 0 |

1 | 1 |

2 | 2 |

3 | 3 |

4 | 4 |

5 | 5 |

6 | 6 |

7 | 7 |

8 | 10 |

9 | 11 |

10 | 12 |

11 | 13 |

12 | 14 |

13 | 15 |

14 | 16 |

15 | 17 |

16 | 20 |

17 | 21 |

### Table of Contents

## 1. DEC2OCT function Syntax

DEC2OCT(*number*, *[places]*)

## 2. DEC2OCT function Arguments

number |
Required. The decimal integer you want to convert. |

[places] |
Optional. The number of characters to use. If not entered the function uses the number of characters needed to complete the task. This argument allows you to addÂ leading 0s (zeros). |

## 3. DEC2OCT function Example

The image above shows the DEC2OCT function in cells D3 an D4. It calculates the octal values based on the corresponding cells which contain different decimal numbers and [places].

Formula in cell D3:

The first cell B3 contains 8 and cell C3 contains the places number, the DEC2OCT function returns 00000010 in cell D3, the second cell B4 contains 16 and the DEC2OCT function returns 00000020 in cell D4.

The next section describes how these values are calculated in detail.

## 4. How is the DEC2OCT function calculated in detail?

There are different methods converting between decimal and hexadecimal, here is one way. Follow these steps to convert from decimal to hexadecimal:

- Divide the decimal number by 8 and write down the quotient and the remainder.
- Repeat the process with the quotient until it is zero. Make sure to note each quotient and remainder as you calculate each number.
- The octal number is the remainders from bottom to top.

For example, let us convert decimal number 199 to octal.

199/8 = 24 and remainder 7

24/8 = 3 and remainder 0

3/8 = 0 and remainder 3

The octal number is formed from the remainders counting from bottom to top. 199 = 307

## 5. DEC2OCT function not working

DEC2OCT returns the **#NUM!** error value if

*Number*is less than -549,755,813,888 or larger than 549,755,813,887. See cells B3 and C3 in the image above.- [places] is negative. See the formula next to cell C5.
- it requires more than the specified places characters. See the formula next to cell C6.

DEC2OCT returns the **#VALUE!** error if

- [places] is not a number. See the formula next to cell C7.
- The number is not a valid base 10 number. See cells B4 and C4 in the image above.

The second argument [places]is truncated if it is not an integer. For example, [places] is 4.1111111111 and the DEC2OCT function truncates it to 4. See the formula next to cell C8.

DEC2OCT ignores places and returns a 10-character hexadecimal number if the decimal number is negative.

### Useful resources

DEC2OCT function - Microsoft

Decimal to Octal Converter

Decimal to Octal - Cuemath

### Functions in 'Engineering' category

The DEC2OCT function function is one of 42 functions in the 'Engineering' category.

## How to comment

How to add a formula to your comment<code>Insert your formula here.</code>

Convert less than and larger than signsUse html character entities instead of less than and larger than signs.

< becomes < and > becomes >

How to add VBA code to your comment[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

How to add a picture to your comment:Upload picture to postimage.org or imgur

Paste image link to your comment.

Contact OscarYou can contact me through this contact form