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. I am trying to use vlookup but I cannot specify the criteria of ba = +/−0.007. Can I do this using vlookup or there is other ways to do it in 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:
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:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.