[英]Non-exact match vlookup with specific critiera
I have to column of data (time A and time B) and I would like to find out for each data a in A if there is a value b in B that meets the criteria of ba = +/−0.007. 我必须对数据进行列(时间A和时间B),并且我想为A中的每个数据找出b中的值b是否满足ba = + /-0.007的标准。 I am trying to use vlookup but I cannot specify the criteria of ba = +/−0.007. 我正在尝试使用vlookup,但是我无法指定ba = +/− 0.007的条件。 Can I do this using vlookup or there is other ways to do it in excel? 我可以使用vlookup做到这一点,还是可以在Excel中使用其他方法做到这一点? Many thanks in advance for help! 在此先感谢您的帮助!
The data example is shown below. 数据示例如下所示。
+----------------+------------------+
| Time A | Time B |
+----------------+------------------+
| 0.000 | 0.000 |
| 1.001 | 1.001 |
| 1.852 | 1.852 |
| 2.725 | 2.729 |
| 3.356 | 3.359 |
| 4.061 | 4.070 |
| 4.423 | 4.431 |
| 4.634 | 4.642 |
| 4.750 | 4.637 |
| 5.390 | 5.398 |
| 5.788 | 5.788 |
| 6.515 | 6.522 |
| 7.010 | 7.010 |
| 7.672 | 7.500 |
| 8.017 | 7.900 |
| 8.073 | 8.200 |
+----------------+------------------+
You could use this VBA solution: 您可以使用以下VBA解决方案:
Sub main()
Dim i As Integer
Dim j As Integer
For i = 2 To 16
For j = 2 To 16
If Abs(Cells(j, 2) - Cells(i, 1)) < 0.007 Then
Cells(i, 3) = j
End If
Next j
Next i
End Sub
It in column C it outputs the matching row index from column B: 它在C列中输出与B列匹配的行索引:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.