I am trying to convert a really small value to percentage but I got a strange number. For example of the small value, -8.45129E-05.
我试图将一个非常小的值转换为百分比但我有一个奇怪的数字。例如,小值,-8.45129E-05。
Currently, I am using below code for conversion.
目前,我使用下面的代码进行转换。
Cells(i, 6) = FormatPercent(Cells(i, 6), 8, , vbTrue)
I got a result of -845.13% if the small value is -8.45129E-05, but the correct result should be -0.00845129%. I guess the issue is caused by the E-05. Any suggestions to fix that?
如果小值为-8.45129E-05,我得到-845.13%的结果,但正确的结果应该是-0.00845129%。我想这个问题是由E-05造成的。有什么建议可以解决吗?
Example with new excel file.
新excel文件的示例。
Line 10 column 6 should be -0.0084513% (122.21/122.76-1)-(1291/1296.7-1) (Column D to F is calculated by Sub and Column H to J is calculated by hand)
第10行第6列应为-0.0084513%(122.21 / 122.76-1) - (1291 / 1296.7-1)(列D至F由Sub计算,H列至J由手动计算)
1 个解决方案
#1
0
I solve this by change
我通过改变来解决这个问题
Cells(i, 6) = FormatPercent(Cells(i, 6), 8, , vbTrue)
to
至
Cells(i, 6) = FormatPercent(Cells(i, 6) * 10000, 8, , vbTrue)
Cells(i, 6) = Cells(i, 6) / 10000
I know this is not the most correct answer. If you have a better one, I will vote yours.
我知道这不是最正确的答案。如果你有一个更好的,我会投票给你。
#1
0
I solve this by change
我通过改变来解决这个问题
Cells(i, 6) = FormatPercent(Cells(i, 6), 8, , vbTrue)
to
至
Cells(i, 6) = FormatPercent(Cells(i, 6) * 10000, 8, , vbTrue)
Cells(i, 6) = Cells(i, 6) / 10000
I know this is not the most correct answer. If you have a better one, I will vote yours.
我知道这不是最正确的答案。如果你有一个更好的,我会投票给你。