如果它是该列表的一部分,则查找数字列表中的位置号码

如果我在Excel中有一系列数字,例如

0 1 8 12 15 27 

我想知道9号在所有这些数字之间的位置(位置4),我该怎么做?

使用Match()函数就好

 Dim pos as Variant pos = Application.Match(9, Range("A1:A10"), 1) + 1 

由于将第三个参数设置为1它会“查找小于或等于lookup_value的最大值”