DECIMAL
TheDECIMAL
function 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
DECIMAL
formula? - Examples of using
DECIMAL
formula DECIMAL
formula not working?- Similar formulas to
DECIMAL
Usage
Use the 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.
Examples
Here are a few example use cases that explain how to use theDECIMAL
formula 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.
Common Mistakes
DECIMAL
not working? Here are some common mistakes people make when using the DECIMAL
Google 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
The 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.
Related Formulas
The following functions are similar to DECIMAL
or are often used with it in a formula:
-
BIN2DEC
The
BIN2DEC
formula 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. -
HEX2DEC
The
HEX2DEC
function 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. -
OCT2DEC
The
OCT2DEC
function 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.
Learn More
You can learn more about the DECIMAL
Google Sheets function on Google Support.