Leigh
Leigh

Reputation: 133

How to convert 14 bit Hex to Decimal

I need to be able to convert 047C1BEA3A2480 into Decimal. This should convert to 1262359242482816. I have a large amount of hex numbers that need converting so would need a formula or VB script.

I have tried some things including a VB Module, however with this I need to prefix the number with 0X but then gives me a decimal number that is out by 4.

Any ideas would be great.

Upvotes: 4

Views: 6554

Answers (2)

Robert Co
Robert Co

Reputation: 1715

Split into 2 7-digits and use the HEX2DEC function. Unfortunately, Excel cannot handle that big a number, so it is rounding when you put it back in Excel. For exmaple, try to paste the decimal version into Excel. But if you want the formula anyway.

=HEX2DEC(LEFT(A4,7))*16^7+HEX2DEC(RIGHT(A4,7))

Otherwise, use Siddarth's solution and put it in Excel as Text.

Upvotes: 1

Siddharth Rout
Siddharth Rout

Reputation: 149295

Use the inbuilt CDec function

Debug.Print CDec("&H" & "047C1BEA3A2480")

This will give you 1262359242482816

Screenshot

enter image description here

Upvotes: 3

Related Questions