Hi iuliandonici,
Assuming this is just an additional requirement to what was in your other thread:
Code:
Sub InOut()
Application.ScreenUpdating = False
Dim StrIn As String, StrOut As String, i As Long, k As Long
Dim StrSub As String, StrAdd As String, j As Long, l As Long
With ActiveSheet()
For i = 7 To .Range("C" & .Rows.Count).End(xlUp).Row
StrAdd = ""
StrSub = ""
k = 0
l = 0
StrIn = Trim(Replace(.Cells(i, 3).Value, ";", ""))
StrOut = Trim(Replace(.Cells(i, 4).Value, ";", ""))
If UBound(Split(StrIn, " ")) = UBound(Split(StrOut, " ")) Then
For j = 0 To UBound(Split(StrIn, " "))
StrAdd = StrAdd & CLng(Split(StrIn, " ")(j)) + CLng(Split(StrOut, " ")(j)) & " "
StrSub = StrSub & CLng(Split(StrIn, " ")(j)) - CLng(Split(StrOut, " ")(j)) & " "
If Split(StrIn, " ")(j) <> 0 Then k = k + 1
If Split(StrOut, " ")(j) <> 0 Then l = l + 1
Next
StrAdd = Replace(StrAdd, " ", "; ")
StrSub = Replace(StrSub, " ", "; ")
Else
StrAdd = "IN/OUT item counts differ"
StrSub = "IN/OUT item counts differ"
End If
.Cells(i, 5).Value = StrAdd
.Cells(i, 6).Value = StrSub
.Cells(i, 7).Value = k
.Cells(i, 8).Value = l
Next
End With
Application.ScreenUpdating = True
End Sub
The additional data go in columns G (In) & H (Out).