Sub timtong2so()
Dim i As Integer, j As Integer, k As Integer, ii As Integer, t As Long
Range("E2:IV22").ClearContents
For i = 2 To Cells(1, 16)
For j = i + 1 To Cells(1, 16)
For k = 2 To Cells(1, 18)
t = Cells(i, 1) + Cells(j, 1)
If t = Cells(k, 3) Then
ii = Cells(k, Columns.Count).End(xlToLeft).Column + 1
Cells(k, ii) = "=A" & i & " + A" & j
End If
Next
Next
Next
End Sub
Sub timtong3so()
Dim i As Integer, j As Integer, m As Integer, k As Integer, ii As Integer, t As Long
Range("E2:IV22").ClearContents
For i = 2 To Cells(1, 16)
For j = i + 1 To Cells(1, 16)
For m = j + 1 To Cells(1, 16)
For k = 2 To Cells(1, 18)
t = Cells(i, 1) + Cells(j, 1) + Cells(m, 1)
If t = Cells(k, 3) Then
ii = Cells(k, Columns.Count).End(xlToLeft).Column + 1
Cells(k, ii) = "=A" & i & " + A" & j & " + A" & m
End If
Next
Next
Next
Next
End Sub