Sheet1得B2单元格中输入
=index(Sheet2!$B$2:$D$13,match($A2,Sheet2!$A$2:$A$13,0),match(B$1,Sheet2!$B$1:$D$1))
拖动公式把Sheet1中其他空白单元格填充即可。
也可用vba解决:
Sub test()
Dim arr,i,r
Set d=crateobject(“Scripting.Dictionary”)
r=Sheet2.Cells(rows.count,1).end(3).row
arr=Sheet2.Range(“A1:D” & r)
For i=1 to Ubound(arr)
d(arr(i,1))=i
next
For i =2 to Sheet1.Cells(rows.count,1).end(3).row
If d.exists(Sheet1.Cells(i,1).Value) then
For j=2 to 4
Sheet2.Cells(i,j)=arr(d(Sheet2.Cells(i,1).Value),j)
Next
End if
Next
end sub