Sub 组合() Dim a, b, c [E1] = "组合" arr = [A2:C405] c = UBound(arr) For i = 1 To c a = 20 - arr(i, 1) '内驱之和 b = 30 - arr(i, 3) '工作号之和 For j = i + 1 To c If arr(j, 1) = a Then If arr(j, 3) = b Then [E65536].End(xlUp).Offset(1, 0) = arr(i, 2) & " " & arr(j, 2) End If End If Next Next End Sub