DECIMAL function
The DECIMAL function in Excel is used to convert a text representation of a number in a given base (from 2 to 36) into a decimal (base 10) number. This function is helpful when you are working with number systems such as binary, octal, or hexadecimal and want to convert them to a decimal format.
Syntax
=DECIMAL(number, base)
Parameters
number: A text string representing the number you want to convert to decimal. The number should be in the base specified by thebaseargument.base: The base of the number system thatnumberis in. It must be an integer between 2 (binary) and 36 (base-36). For example, base 2 represents binary, base 16 represents hexadecimal, and so on.
Return Value
The function returns the decimal equivalent of the given number in the specified base.
Example 1: Convert Binary to Decimal
If you want to convert the binary number “1011” to decimal:
=DECIMAL("1011", 2)
Result: 11
(The binary number “1011” is equal to 11 in decimal.)
Example 2: Convert Hexadecimal to Decimal
To convert the hexadecimal number “A1” to decimal:
=DECIMAL("A1", 16)
Result: 161
(The hexadecimal number “A1” is equal to 161 in decimal.)
Example 3: Convert Octal to Decimal
To convert the octal number “17” to decimal:
=DECIMAL("17", 8)
Result: 15
(The octal number “17” is equal to 15 in decimal.)
Important Notes
- The DECIMAL function is case-insensitive, meaning that both “a1” and “A1” would give the same result when converting from hexadecimal.
- The
numberargument must be a valid number in the specified base. If you provide an invalid number for the given base, the function will return a #VALUE! error.
Use Cases
- Programming: When dealing with low-level programming or embedded systems, you often need to convert values between different bases (binary, octal, hexadecimal) and decimal.
- Mathematics: In areas such as number theory and algebra, you may need to work with different numeral systems, and the DECIMAL function helps with conversions.
- Engineering: In certain engineering fields, like digital logic and computer engineering, conversions between bases are often necessary for tasks like error detection, data representation, and calculations in various base systems.