如果我了解您的数据,似乎 Data2 是年龄的原始列表,而 Data1 是分箱数据。
您可以通过数组公式将原始年龄数据移动到绑定中
=FREQUENCY(<bins>,<Data2>)
你的垃圾箱在哪里
10
15
18
20
21
22
25
30
35
40
45
50
55
60
65
70
75
80
85
另外,如果我的第一个猜测不是您想要的,您可以尝试这个 UDF...
Public Function Between(inputCell As Range, twoColBetweenRage As Range, outputLabel As Range)
If twoColBetweenRage.Rows.Count <> outputLabel.Rows.Count Then
Err.Raise 12345, "", "Input ranges are not equally sized"
Exit Function
End If
Dim r As Integer, inputValue As Double
inputValue = inputCell.Value
For r = twoColBetweenRage.Row To twoColBetweenRage.Rows.Count
If twoColBetweenRage(r, 1) <= inputValue And twoColBetweenRage(r, 2) >= inputValue Then
Between = outputLabel(r, 1)
Exit Function
End If
Next r
If IsEmpty(Between) Then
Err.Raise 12345, "", "No value was found"
Exit Function
End If
End Function