If this is not how you wanted, post a workbook. Picture doesn't help at all.
Sub test()
Dim a, i As Long, n As Long, w, x
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
a = Sheets("sheet1").Cells(1).CurrentRegion.Value
For i = 2 To UBound(a, 1)
.Item(a(i, 1)) = a(i, 2)
Next
a = Sheets("sheet2").Cells(1).CurrentRegion.Value: n = 1
For i = 2 To UBound(a, 1)
If .exists(a(i, 1)) Then
x = .Item(a(i, 1)) - a(i, 2)
If x = 0 Then .Remove a(i, 1)
Else
x = a(i, 2)
End If
If x <> 0 Then
n = n + 1
a(n, 1) = a(i, 1): a(n, 2) = x
End If
Next
If .Count Then w = Application.Transpose(Array(.keys, .items)): i = .Count
End With
With Sheets("sheet3").Cells(1).Resize(, 2)
.Resize(n).Value = a
If IsArray(w) Then .Offset(n).Resize(i).Value = w
End With
End Sub
Bookmarks