In this blog post, you learn how to convert one type of number to another type using excel functions. Excel has a list of functions to convert between the number types Decimal, Hexadecimal, Octal, and binary.
Hexadecimal is a number system and the symbols are 0–9 and A–F. The hexadecimal value is used to represent RGB colors on web pages. eg. Hex value #FF0000 is equal to decimal 255, this value for the color Red in programming.
Octal is a base 8 numerical system and Binary is a base 2.
The below list of functions are available in excel to convert decimal to other types of numbers.
To convert the decimal number 100 to others.
Syntax: DEC2HEX( number, [places] )
Types | Excel Functions | Output |
Binary | DEC2BIN | 1100100 |
Octal | DEC2OCT | 144 |
Hexadecimal | DEC2HEX | 64 |
Steps to convert Decimal to Hexadecimal
In this example, we consider a decimal number 100 and find its equivalent hexadecimal number.
- Divide the decimal number100 by 16 and note down the quotient and remainder 100/16= 6 and 4
- Divide the remainder (4) by 16. 4/10 = 0 and 4, now the quotient is 0. So 4 is the least significant digit in the hexadecimal number.
- Now write down the previous steps quotient number in hexadecimal symbols.
The hexadecimal equivalent of 100 is 64. You have divided the number by 16 because of the hexadecimal base is 16. If you need to convert the same to an Octal or Binary number you have to divide by 8 or 2 respectively.
You have the below list of functions in Excel to convert between number types.
Decimal to Other | Hex to Other | Octal to Other | Binary to Other |
DEC2HEX() | HEX2DEC() | OCT2DEC() | BIN2DEC() |
DEC2OCT() | HEX2OCT() | OCT2HEX() | BIN2HEX() |
DEC2BIN() | HEX2BIN() | OCT2BIN() | BIN2OCT() |
Conclusions
It is an important concept to understand the number conversion for working with digital concepts. You need this conversion formula when you work with color systems.
If you have any questions, please leave a comment below and I will get back to you as soon as possible.