由于你没提到结果存放在哪儿, 我就把它们存放在E5里面了. 不喜欢的话可以改, 很简单的.
在Excel里面按Alt+F11, 然后双击左边窗口中的的Sheet1, 复制以下代码, 按F5运行.
或者回到Excel中, 按Alt+F8, 然后选中"Calc"宏运行即可.
Public Sub Calc()
Dim LA As Long
Dim LC As Long
Dim Found As Long
LA = 1
Do Until IsEmpty(Cells(LA, 1))
LC = 1
Do Until IsEmpty(Cells(LC, 3))
If Cells(LA, 1) = Cells(LC, 3) Then
Found = Found + 1
Cells(Found, 5) = "A" & LA & "-" & "C" & LC & " = " & Cells(LA + 1, 1) - Cells(LC + 1, 3)
End If
LC = LC + 1
Loop
LA = LA + 1
Loop
Cells(Found + 1, 5) = "找到 " & Found & " 个"
MsgBox "计算完毕!"
End Sub