EXCEL表中如何利用VLOOKUP将2张工作表的数据匹配?
excel表格中,匹配关键字可以找出两个表格数据的相同值并进行分析与计算。通常有两种方法:1 公式法:比如在sheet1的A列,需要查找sheet2的B列在不在A列里面,那么在Sheet2的C列就可以写如下公式:=vlookup(B1,sheet1!A:A,1,0)sheet1的数据:sheet2的数据与公式途中#N/A就是没有找到,未匹配。方法二:通过vba代码来查找并上色:Sub filterDim s1 As VariantDim i, j As IntegerDim foundRange As RangeApplication.ScreenUpdating = Falses1 = Sheet2.Range(B1:B180).ValueFor i = 1 To UBound(s1, 1)Set foundRange = Sheet1.Range(B1:B20357).Find(What:=s1(i, 1), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext)If Not foundRange Is Nothing ThenSheet1.Cells(foundRange.Row, 2).EntireRow.Interior.Color = rgbRedElseMsgBox s1(i, 1) 并未在sheet1中找到, 64End IfNext iApplication.ScreenUpdating = TrueEnd Sub