I think that this code will work:
Sub Sort()
lastrowi = Range("C" & Rows.Count).End(xlUp).Row
j = 3
For i = 3 To lastrowi
For k = 3 To j
If (Cells(i, "A") = Cells(k, "F") And Cells(i, "B") = Cells(k, "G") And Cells(i, "D") = Cells(k, "I")) Then
equal = "TRUE"
Exit For
Else
equal = "FALSE"
End If
Next k
If equal = "FALSE" Then
Cells(j, "F") = Cells(i, "A")
Cells(j, "G") = Cells(i, "B")
Cells(j, "I") = Cells(i, "D")
j = j + 1
End If
Next i
lastrowA = Range("A" & Rows.Count).End(xlUp).Row
lastrowF = Range("F" & Rows.Count).End(xlUp).Row
Max = "empty"
Min = "empty"
For i = 3 To lastrowF
For j = 3 To lastrowA
If Cells(i, "F") = Cells(j, "A") And Cells(i, "G") = Cells(j, "B") And Cells(i, "I") = Cells(j, "D") Then
If Max = "empty" Then
Max = Cells(j, "C")
Min = Cells(j, "C")
Else
If Cells(j, "C") < Min Then
Min = Cells(j, "C")
End If
If Cells(j, "C") > Max Then
Max = Cells(j, "C")
End If
End If
End If
Next j
Cells(i, "H") = (Max - Min) + 1
Max = "empty"
Min = "empty"
Next i
End Sub