Contact

DECIMAL in Excel: Parse Base-2 Through Base-36 Text as Numbers

Math and trigonometry Intermediate Microsoft Excel

Convert binary and hexadecimal text with Excel DECIMAL, explain positional digits and protect long source strings from precision loss.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: DECIMAL reads text written in a specified base and returns its numeric value. =DECIMAL("2D",16) has the expected result 45. The name refers to base-ten conversion, not rounding decimal places.

Availability and version history

  • Introduced: Marked as an Excel 2013 addition in the Microsoft function catalogue; an exact first build is not established.
  • Availability: official help lists Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel 2024, Excel 2024 for Mac, Excel 2021, Excel 2021 for Mac, Excel 2019, Excel 2016.
  • Checked: October 14, 2026; official DECIMAL reference. Examples are independently calculated expectations, not native Excel test results.

Syntax and valid digits

=DECIMAL(text, radix)

Both arguments are required. Radix identifies a base from 2 through 36. Digits must belong to that base: hexadecimal uses 0–9 and A–F, while base 36 extends letters through Z. Letter case does not affect conversion. Official DECIMAL reference

Microsoft documents a maximum text length of 255 characters and possible #NUM! or #VALUE! results when constraints are violated. It also warns that a text value resolving beyond 2^53 can lose precision. This is not an arbitrary-length integer parser.

Example 1: decode a few labeled representations

Enter the text and radix columns below in A1:B5. Format column A as Text before entering digit-only strings, or enter a leading apostrophe as an input marker; the apostrophe is not part of the stored text.

A: Text B: Radix Expected number
101101 2 45
55 8 45
2D 16 45
19 36 45

In C2 enter =DECIMAL(A2,B2) and fill down through C5. Each result is 45, despite the visibly different source strings.

Preserve the radix with the text. A string such as 19 is ambiguous without its base: decimal text nineteen and base-36 text nineteen represent different quantities.

Example 2: understand place values

=DECIMAL("1Z",36)

Expected result: 71. Z has digit value 35, so the calculation is 1×36+35. For a three-position hexadecimal example:

=DECIMAL("3A7",16)

Expected result: 935, because 3×16²+10×16+7 = 768+160+7. This handwritten decomposition is an independent check that the radix and digit interpretation are correct.

For =DECIMAL("3a7",16), the expected result is also 935. Case normalization is unnecessary for this function, though a receiving system may have separate display rules.

Example 3: leading zeros do not change the quantity

=DECIMAL("00002D",16)

Expected result: 45. The numeric result does not retain the width of the original text. If six-character codes are significant identifiers, keep the original string as well as the number.

Use LEN on the source to check width, not on the converted numeric value. =LEN("00002D") is 6; that detail cannot be recovered merely from the result 45.

Advanced example: convert a padded identifier for arithmetic

Suppose A2 and A3 contain the hexadecimal strings 00F0 and 0108. In B2 and B3 convert each with =DECIMAL(A2,16) filled down.

Expected numeric values: 240 and 264. The formula =B3-B2 returns 24. A direct equivalent is:

=DECIMAL(A3,16)-DECIMAL(A2,16)

This calculates numeric distance between two representations. It does not count actual issued identifiers, detect missing records or establish that the codes form a continuous sequence.

To display the result as a number, use an ordinary numeric format. To produce a new base-specific string, use a conversion function rather than merely changing the cell’s number format.

Advanced example: sort hexadecimal codes numerically

Enter F, 10, 2A, 9 as text in D2:D5. In E2 enter =DECIMAL(D2,16) and fill down. Expected helper values: 15, 16, 42, 9.

Sort the complete D2:E5 range by E ascending. Expected source-code order: 9, F, 10, 2A. Sorting only D alphabetically does not express this numeric order, and sorting only E would detach values from their source codes.

A total of the helper values is =SUM(E2:E5), expected 82, providing a simple before-and-after check when rearranging this complete sample.

Input errors and precision boundaries

The string 102 is invalid in base 2 because digit 2 is unavailable there; G1 is invalid in base 16. Rather than asserting an unverified error-code matrix, use Microsoft’s documented #NUM!/#VALUE! family and inspect the original text and radix.

For a review column you can use =IFERROR(DECIMAL(A2,16),"Review code"), with IFERROR catching a conversion error. The label is a workflow choice, not proof that every source error has the same cause.

Keep long digit strings as text during import. Once a spreadsheet has rounded an input as a number, quoting or converting the rounded value cannot reconstruct the lost digits. A 255-character allowance describes acceptable text length; it does not guarantee 255-digit numerical accuracy.

For reliable tests, start with small exact integers, verify positional arithmetic and only then extend the workbook to realistic codes and the destination’s required limits.

Verification: Fictional inputs and independently calculated outputs; no native Excel execution. See the editorial testing standards.