请确认百万条级的东西要在EXCLE中查么?会非常慢的,出一个简单的循环,表达一下达成的意思。
Function nlookup(rng1 As Range, rng2 As Range, col As Integer, n As String)
'n = InputBox("确定顺序,请输入Y或N,N为反查")
Dim icol%, irow%, i%
icol = rng2.Columns.Count
irow = rng2.Rows.Count
If n = "N" Then
For i = 1 To irow
If rng1 = rng2.Cells(i, icol) Then
nlookup = rng2.Cells(i, icol - col + 1)
Exit For
End If
Next
Else
For i = 1 To irow
If rng1 = rng2.Cells(i, 1) Then
nlookup = rng2.Cells(i, col)
Exit For
End If
Next
End If
End Function
vlookup(条件,条件区域,匹配区域)
你的正反向查找是个什么概念?
条件存在于条件区域内,匹配匹配区域,存在于匹配区域内,匹配条件区域?
这样写个自定义高数,双向遍历就行了
那你应该使用鼠标按下,弹起事件啊
捕捉是从左到右,还是从右到左
直接用VLOOKUP不行吗
for i = 1 to 5
Cells(i, 10) = Evaluate("=VLOOKUP(G" & i & ",IF({1,0},C:C,A:A),2,0)")
NEXT
写代码来实现