更改PercentRank函数输出的数字格式
当我使用PercentRank函数时,消息框以“0.00”数字格式吐出数字。 有什么方法可以改变吗? 最好是“00%”
x = WorksheetFunction.PercentRank(relevant_Array, answer, 2) If x > 0.7 Then MsgBox "WARNING: Price is more than 20% above the average price: " & x If x < 0.3 Then MsgBox "WARNING: Price is more than 20% below the average price: " & x If x > 0.3 And x < 0.7 Then MsgBox "Carry on: your price seems to be accurate: " & x
你有没有尝试VBA的格式function ?
If x > 0.7 Then MsgBox "WARNING: Price is more than 20% above the average price: " & Format(x, "00%")
你也可以试试这个…
If x > 0.7 Then MsgBox "WARNING: Price is more than 20% above the average price: " & Round(x*100,0) & ''%''