DECIMALfunction returns the decimal value of a number that has been converted from another base. This is useful when working with numbers in non-decimal bases such as binary or hexadecimal. The function takes two parameters, the first is the value to convert and the second is the base of the number being converted.
- How to use
- Examples of using
DECIMALformula not working?
- Similar formulas to
DECIMAL formula with the syntax shown below, it has 2 required parameters:
- value (required):
The value to convert to decimal. This can be a number in any base, but it must be a string.
- base (required):
The base of the number being converted. This can be any integer between 2 and 36.
ExamplesHere are a few example use cases that explain how to use the
DECIMALformula in Google Sheets.
Convert binary to decimal
To convert a binary number to decimal, use the
DECIMAL function with a base of 2.
Convert hexadecimal to decimal
To convert a hexadecimal number to decimal, use the
DECIMAL function with a base of 16.
Convert octal to decimal
To convert an octal number to decimal, use the
DECIMAL function with a base of 8.
DECIMALnot working? Here are some common mistakes people make when using the
DECIMALGoogle Sheets Formula:
Using an incorrect base
If the second argument to the
DECIMAL formula is not the correct base of the number being converted, the result will be incorrect. For example, using a base of 16 to convert a binary number will result in an incorrect decimal value.
Incorrectly formatted input text
DECIMAL formula expects the input text to be in the format of the specified base, with each digit represented by a character. If the input text is not formatted correctly, the formula will return an error.
The following functions are similar to
DECIMAL or are often used with it in a formula:
BIN2DECformula is an engineering formula used to convert a signed binary number to a decimal number. This formula is commonly used in computer science and engineering fields.
HEX2DECfunction converts a signed hexadecimal number to its decimal equivalent. This function is commonly used in engineering calculations where hexadecimal numbers are used to represent signed values.
OCT2DECfunction converts a signed octal number to its decimal equivalent. It takes one required parameter, the signed_octal_number, which is the signed octal number you want to convert to decimal. The function returns the decimal equivalent of the signed octal number.
You can learn more about the
DECIMAL Google Sheets function on Google Support.