如何解决这个转换器hex到八进制像excel?

我试图将hex转换为八进制像在C#中的Excel。

在普通转换器中:

=Hex2Oct("FFF0FFFFFF") Answer:17776077777777 

在Excel中:

 =Hex2Oct("FFF0FFFFFF") Answer:6077777777 

我怎么能解决这个问题有人知道请build议我?

Excel会截断结果,因此不正确; 根据手册

https://support.office.microsoft.com/en-nz/article/HEX2OCT-function-d52055af-1be5-43c1-9319-2ce0ab3569f4

 - If number is negative, it cannot be less than FFE0000000, and if number is positive, it cannot be greater than 1FFFFFFF. 

所以你的论点(“FFF0FFFFFF”)超出范围。

示例C#代码

 private static String Hex2Oct(String value) { // Assuming that given value is short enough to be represented as Int64 return Convert.ToString(Convert.ToInt64(value, 16), 8); } ... Console.Write(Hex2Oct("FFF0FFFFFF")); // 17776077777777