答案 0 :(得分:0)
我将为您提供一个小示例,说明如何通过VBA完成此操作,请注意,这不是任何设置的动态解决方案-您也未提供有关此设置的详细信息或如何获得结果。您会发现我的输出与您的输出不同:
通常我不会回答未显示尝试的问题,但是当@ScottCraner无法通过公式解决时,我不得不兜售我的VBA:)
Option Explicit
Sub PopulateTable()
Dim i As Long, j As Long, k As Long
Dim lastrow As Long, lastrow2 As Long
k = 16
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
lastrow2 = Cells(Rows.Count, 4).End(xlUp).Row
For i = 2 To lastrow
For j = 2 To lastrow2
If Cells(i, 2).Value = Cells(j, 5).Value Then
Cells(k, 1).Value = Cells(i, 1).Value
Cells(k, 2).Value = Cells(i, 2).Value
Cells(k, 3).Value = Cells(j, 4).Value
k = k + 1
End If
Next j
Next i
End Sub