【发布时间】:2016-10-17 00:45:31
【问题描述】:
我正在尝试使用 PERCENTRANK 函数来查找“答案”在“B”列中排名的百分位数。 PercentRank 函数从“Dim x As Double”开始,我只包含其余代码以显示我还在做什么。
Dim response As VbMsgBoxResult
response = MsgBox("Is This Item Catch Weight?", vbYesNo)
If response = vbNo Then
Dim cost, weight, answer As Variant
Dim myrng As Range
cost = InputBox("Please Enter PO Cost")
weight = InputBox("Please Enter Net Weight")
answer = cost / weight
MsgBox "Price per KG is: " & answer
Dim x As Double
Set ws = ActiveWorkbook.Worksheets("Sheet1")
Set relevant_array = ws.Range(ws.Range("B1"), ws.Range("B1").End(xlDown))
x = WorksheetFunction.PercentRank(relevant_array.Address, answer)
Debug.Print x
Exit Sub
【问题讨论】:
标签: excel vba macros percentile