There seemed to be some inconsistency in your "results" sheet, but try the following and see if it does what you're looking for:
Sub CopyInput()
Dim LastOut As Long
Dim LastIn As Long
LastOut = Sheets("output data").Cells(Rows.Count, "B").End(xlUp).Row
Application.ScreenUpdating = False
For i = LastOut To 2 Step -1
LastIn = Sheets("Input data").Cells(Rows.Count, "B").End(xlUp).Row
For j = LastIn To 2 Step -1
If Sheets("Input data").Cells(j, "A").Value = Sheets("output data").Cells(i, "B").Value Then
Sheets("output data").Rows(i + 1 & ":" & i + (LastIn - j)).Insert Shift:=xlDown
Sheets("Input data").Range("B" & j & ":D" & LastIn).Copy
Sheets("output data").Range("F" & i).PasteSpecial (xlValues)
Exit For
End If
If Sheets("Input data").Cells(j, "A").Value <> "" Then LastIn = j - 1
Next j
Next i
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Bookmarks