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.
我需要能够将047c1bea2480转换成十进制。这应该转换为1262359242482816。我有大量需要转换的十六进制数字,所以需要一个公式或VB脚本。
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.
我尝试过一些东西,包括一个VB模块,但是我需要在这个数字前面加上0X,然后给我一个十进制数,这个数字是4。
Any ideas would be great.
任何想法都很好。
2 个解决方案
#1
3
Use the inbuilt CDec
function
使用内置的CDec函数
Debug.Print CDec("&H" & "047C1BEA3A2480")
This will give you 1262359242482816
这会得到12623592482816
Screenshot
截图
#2
0
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.
分成2个7位数字,使用HEX2DEC函数。不幸的是,Excel无法处理这么大的数字,所以当你把它放回Excel时,它是四舍五入的。对于exmaple,尝试将十进制版本粘贴到Excel中。但是如果你想要这个公式。
=HEX2DEC(LEFT(A4,7))*16^7+HEX2DEC(RIGHT(A4,7))
Otherwise, use Siddarth's solution and put it in Excel as Text.
否则,使用悉达斯的解决方案并将其作为文本放在Excel中。
#1
3
Use the inbuilt CDec
function
使用内置的CDec函数
Debug.Print CDec("&H" & "047C1BEA3A2480")
This will give you 1262359242482816
这会得到12623592482816
Screenshot
截图
#2
0
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.
分成2个7位数字,使用HEX2DEC函数。不幸的是,Excel无法处理这么大的数字,所以当你把它放回Excel时,它是四舍五入的。对于exmaple,尝试将十进制版本粘贴到Excel中。但是如果你想要这个公式。
=HEX2DEC(LEFT(A4,7))*16^7+HEX2DEC(RIGHT(A4,7))
Otherwise, use Siddarth's solution and put it in Excel as Text.
否则,使用悉达斯的解决方案并将其作为文本放在Excel中。