打开VBA输入
Sub TEXT()
Dim RNG As Range, RNG1 As Range, RNG2 As Range, RNG3 As Range, RNG4 As Range
Set RNG = Sheet1.Range("B2", Sheet1.[B2].End(xlDown))
' MsgBox RNG.Address
For Each RNG1 In RNG
Set RNG2 = Sheet2.Range("B2", Sheet2.[B2].End(xlDown)).Find(RNG1.Value)
Set RNG3 = Sheet2.Range("C1:D1").Find(RNG1(1, 2).Value)
Set RNG4 = Sheet2.Cells(RNG2.Row, RNG3.Column)
' MsgBox RNG2.Address
' MsgBox RNG3.Address
' MsgBox RNG4.Address
RNG4 = Format(RNG1(1, 3), "H:M:S")
Next
End Sub
这种还用什么公式啊,一张透视表一键解决你的问题了都。