Decimal values in excel

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel for Mac 2011 More…Less

This article describes the formula syntax and usage of the DECIMAL
 function in Microsoft Excel.

Description

Converts a text representation of a number in a given base into a decimal number.

Syntax

DECIMAL(text, radix)

The DECIMAL function syntax has the following arguments.

  • Text    Required.

  • Radix    Required. Radix must be an integer.

Remarks

  • The string length of Text must be less than or equal to 255 characters.

  • The Text argument can be any combination of alpha-numeric characters that are valid for the radix, and is not case sensitive.

  • Excel supports a Text argument greater than or equal to 0 and less than 2^53. A text argument that resolves to a number greater than 2^53 may result in a loss of precision.

  • Radix must be greater than or equal to 2 (binary, or base 2) and less than or equal to 36 (base 36).
    A radix greater than 10 use the numeric values 0-9 and the letters A-Z as needed. For example, base 16 (hexadecimal) uses 0-9 and A-F, and base 36 uses 0-9 and A-Z.

  • If either argument is outside its constraints, DECIMAL may return the #NUM! or #VALUE! error value.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Formula

Description

Result

How it works

‘=DECIMAL(«FF»,16)

Converts the hexadecimal (base 16) value FF to its equivalent decimal (base 10) value (255).

=DECIMAL(«FF»,16)

«F» is in position 15 in the base 16 number system. Because all number systems start with 0, the 16th character in hexadecimal will be in the 15th position. The formula below shows how it is converted to decimal:

The HEX2DEC function in cell C3 verifies this result.

=HEX2DEC(«ff»)

Formula

=(15*(16^1))+(15*(16^0))

‘=DECIMAL(111,2)

Converts the binary (base 2) value 111 to its equivalent decimal (base 10) value (7).

=DECIMAL(111,2)

«1» is in position 1 in the base 2 number system. The formula below shows how it is converted to decimal:

The BIN2DEC function in cell C6 verifies this result.

=BIN2DEC(111)

Formula

=(1*(2^2))+(1*(2^1))+(1*(2^0))

‘=DECIMAL(«zap»,36)

Converts the value «zap» in base 36 to its equivalent decimal value (45745).

=DECIMAL(«zap»,36)

«z» is in position 35, «a» is in position 10, and «p» is in position 25. The formula below shows how it is converted to decimal.

Formula

=(35*(36^2))+(10*(36^1))+(25*(36^0))

Top of Page

Need more help?


Download Article


Download Article

Do you have data entered into your Excel sheet and want to see only the decimals? This wikiHow will teach you how to extract a decimal value in Excel using a formula.

Steps

  1. Image titled Extract a Decimal Value in Excel Step 1

    1

    Open your project in Excel. If you’re in Excel, you can go to File > Open or you can right-click the file in your file browser.

  2. Image titled Extract a Decimal Value in Excel Step 2

    2

    Select an empty cell where you want to display your decimal value. This can be anywhere on your spreadsheet since the formula contains the cell you want to extract data from.

    • For example, you can select cell E7 even if all your data is located in cells A1-A20.

    Advertisement

  3. Image titled Extract a Decimal Value in Excel Step 3

    3

    Enter the formula: =ABS(A1-TRUNC(A1)). A1 represents the cell the data is located within, so you’ll want to change that if your data isn’t in cell A1.

    • If you want to keep the negative or positive signs with your decimals, use the formula =A1-TRUNC(A1).[1]
  4. Image titled Extract a Decimal Value in Excel Step 4

    4

    Press Enter (Windows) or Return (Mac). The cell you have selected and entered the formula in will display the decimal value only within the string.[2]

  5. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Thanks for submitting a tip for review!

References

About This Article

Article SummaryX

1. Open your project in Excel.

2. Select an empty cell where you want to display your decimal value.
3. Enter «=ABS(A1-TRUNC(A1))».

4. Press Enter (Windows) or Return (Mac).

Did this summary help you?

Thanks to all authors for creating a page that has been read 8,272 times.

Is this article up to date?

The Excel DECIMAL function allows us to convert alpha-numeric representations of numbers in a specified base into their equivalent in decimals.

Figure 1. of Excel Decimal Function

Generic Formula

=DECIMAL (number, radix)

  • number = alpha-numeric values
  • radix – A number value representing the base of the number to be converted (within the range of 2 – 36)

How to Set Decimal Places in Excel

  1. First, we have to set up the available data in our Excel worksheet:

Figure 2. of Decimal Function in Excel

The input string of numbers (column B above) must contain only valid alpha-numeric characters which correspond with our supplied base (radix).

Below is a standard list of alpha-numeric characters with their correspond base values:

Figure 3. of Standard Alpha-numeric and Base Values in Excel

Our goal in Figure 2. above, is to convert the NUMBER values in column B into the  decimal Excel values of the five different bases in column A.

  1. The Decimal Excel formula we will enter into cell D2 of our worksheet example is as follows:

=DECIMAL(B2,C2)

Figure 4. of Decimal Function in Excel

The number in cell B2 is a binary value that has a base 2.  We now know its Excel decimal value is 2 (cell D2).

  1. To determine the succeeding Excel Decimal values, modify and copy Excel Decimal formula in D2 down into other cells in the column:

Figure 5. of Decimal Function in Excel

Each number is then converted its corresponding Excel decimal value in cells D4to D6.  

How to Adjust Decimal Places in Excel

If our goal is to specify or move decimal points in Excel, follow the simple steps below:

  1. Open the “Format” menu
  2. Click on the “Format Cells” button, and then a “Format Cells” window will emerge;

Figure 6. of Format Cells Button in Excel

Figure 7. of Format Cells Window in Excel

  1. Click on the “Number” tab, and then select the “Number” item from the Category list; we should locate the “Decimal Place” button in the right section of the window. From here, we can now format the exact number of decimal places in Excel.

How to Limit Decimal Places in Excel

We can easily limit decimal places in Excel by formatting cells.

Follow the steps below to make Excel limit decimal places

  1. Select the cell(s) which we want to change their decimal Excel limit and then right click on those selected cells, before selecting the “Format Cells” option which is on the right-click menu;

Figure 8. of Format Cells Button in Excel

  1. In the next “Format Cells” window, click on the “Number” tab, and then choose “Number” in the Category section, and then enter a number value representing the decimal limit inside the “Decimal Places”input bar..

For example, if we seek to limit the selected cells to just 1 Excel decimal place, simply type “1”

Figure 9. of Decimal Limit in Excel

  1. Clicking on “OK” will close the Format Cells window and then you will observe all the decimals in our selected cells have been changed to a single Excel decimal place.

Figure 10. of Limit Decimal Places in Excel

Purpose 

Convert a number in a different base to a decimal number

Usage notes 

The DECIMAL function converts a number in a known base into its decimal number equivalent. For example, the DECIMAL function can convert the binary number 1101 into the decimal number 13. The number provided to DECIMAL should be a text string.

The DECIMAL function takes two arguments: number and radix. Number should be the text representation of a number in a known base. Radix is the number of digits used to represent numbers (i.e. the base) and should be an integer between 2 and 36. The characters given in number need to conform to the numbering system specified with radix

Examples

In the hexadecimal number system, the number 255 is represented as «FF». To convert the text string «FF» to the decimal number 255, you can use the DECIMAL function like this:

=DECIMAL("FF",16) // returns 255

To convert the binary number 1101 to its decimal number equivalent, 13, use DECIMAL like this:

=DECIMAL("1101",2) // returns 13

In the example shown, the numbers in column B are in different bases, and the base is given in column C. The formula in column D5 is:

=DECIMAL(B5,C5) // returns 3

As the formula is copied down, the DECIMAL function converts each number in column B to its decimal equivalent using the base specified in column C for the radix argument. The decimal numbers in column D are the output from DECIMAL.

BASE function

The BASE function performs the opposite conversion as the DECIMAL function:

=BASE(100,2) // returns "1100100"
=DECIMAL("1100100",2) // returns 100

See more on the BASE function here.

Number system characters

Different bases use different alphanumeric characters to represent numbers. The table below shows the characters uses for binary, octal, decimal, and hexadecimal number systems.

Name Base Alphanumeric characters
binary 2 0 — 1
octal 8 0 — 7
decimal 10 0 — 9
hexadecimal 16 0 — 9 and A — F

Notes

  • The number argument should be provided as a text string.
  • The result from DECIMAL is a numeric value.
  • If number is negative, DECIMAL returns a #NUM! error.
  • if number contains a decimal value,  DECIMAL returns a #NUM! error.
  • If number is out-of-range for the given base, DECIMAL returns a #NUM! error.

Convert a number in a stated base into a decimal value

What is the DECIMAL Function?

The DECIMAL Function[1] in Excel is a Math and Trigonometry function. It is used for converting a text representation of a number in a stated base into a decimal value. The function was introduced in MS Excel 2013.

Formula

=DECIMAL (text, radix)

Where:

  • Text is the text representation of a number. The text string must be in quotation marks.
  • Radix is the base of the number given. It must be an integer and should be greater than or equal to 2 (binary or base2) and less than or equal to 36 (base 36).

If radix is greater than 10, it will use 0-9 numeric values and A-Z letters as required. For example, if we use base 16, it will use 0-9 and A-F. For base 30, it will use 0-9 and A-T.

How to use the DECIMAL Function in Excel?

To understand how to use this function, let’s consider a few examples:

Example 1

Let’s assume we wish to convert the three random letters “C”, “F”, and “A” in base 36 to its equivalent decimal value. The formula to be used would be:

DECIMAL Function

This Decimal function used the formula =(12*(36^2))+(15*(36^1))+(10*(36^0)) as “C” is in position 12, “F” in position 15 and “A” in position 10. The result would be:

DECIMAL Function - Example 1

Example 2

Let’s take this example wherein we wish to convert the binary (base 2) value 1111 to its equivalent decimal.

DECIMAL Function - Example 2

The DECIMAL Function will convert 1111 to its equivalent decimal (base10) value of 15.

DECIMAL Function - Example 2a

Here the formula used is =(1*(2^3)) +(1*(2^2)) +(1*(2^1)) +(1*(2^0)). We can cross check this result with BIN2DEC function. The formula to be used would be BIN2DEC (“1111”).

Example 3

Let’s assume we wish to convert the hexadecimal (base 16) value FFF to its equivalent decimal (base 10) value (255). The formula that we can use would be:

DECIMAL Function - Example 3

The DECIMAL Function used the formula =((15*(16^2)+(15*(16^1))+(15*(16^0)).

Here, F is in position 15 in the base 16 number system. As all number systems start with 0, the 16th character in hexadecimal will be in the 15th position. We would get the result 4095.

DECIMAL Function - Example 3a

Example 4

Now, let’s say we wish to convert “I wish to travel” into a decimal.

DECIMAL Function - Example 4

The result would be:

DECIMAL Function - Example 4a

Example 5

Now, let’s see a few more examples to understand how the DECIMAL function works:

DECIMAL Function - Example 5

A few pointers about the DECIMAL Function

  1. The length of the text must be less than or equal to 255 characters. If the length exceeds 255 characters, the formula gives an error.
  2. #NUM! error would occur when the argument is outside its constraints.
    • The radix given is < 2 or > 36.
    • The text argument given is not recognized as a number in the specified base (radix). For example, if we give the argument =DECIMAL (“200”,2). As 200 is not a valid representation of a binary number, we would get a #NUM! error.
    • When the number of characters exceeds 255.
  3. #VALUE! error occurs when the text argument or radix is outside its constraints
    • When the given text argument is more than 255 characters.
    • When the radix given is non-numeric.
  4. The radix should be either greater than or equal to 2 (binary or base 2). Also, it should be less than or equal to 36 (base 36). If the given radix is greater than 10, the function will use numeric values (0-9) and the letters A-Z as needed. For example, base 17 would use 0-9 and A-G whereas base 36 would use 0-9 and A-Z.
  5. Text argument is not case sensitive so it will provide the same results for =DECIMAL(“atfd”, 30) and =DECIMAL(“ATFD”, 30).

Click here to download the sample Excel file

Additional Resources

Thanks for reading CFI’s guide to important Excel functions! By taking the time to learn and master these functions, you’ll significantly speed up your financial analysis. To learn more, check out these additional CFI resources:

  • Excel Functions for Finance
  • Advanced Excel Formulas Course
  • Advanced Excel Formulas You Must Know
  • Excel Shortcuts for PC and Mac
  • See all Excel resources

Article Sources

  1. DECIMAL Function

Понравилась статья? Поделить с друзьями:
  • Decimal places in excel
  • Decided which category each word belongs to
  • Decide with word is the odd one out
  • Decide with category each word belongs to
  • Decide who or what the following word combinations describe read out the sentences