|
发表于 2016-7-18 10:54
|
显示全部楼层
本楼为最佳答案
hanjia 发表于 2016-7-18 10:04
就是 A1-B1相同C1=0 正数=1 负数=2
一,就是 A1是1或者2 直接在C1=1 3以上才跟B1对比
二,数据 ...
用vba试试
Sub xx()
Dim i&
For i = 1 To Range("A65536").End(xlUp).Row
If Cells(i, 1) <> "" Then
If Cells(i, 1) > 0 And Cells(i, 1) <= 2 Then
Cells(i, 3) = 1
End If
If Cells(i, 1) > 2 And Cells(i, 1) <= 9 Then
If Cells(i, 1) = Cells(i, 2) Then
Cells(i, 3) = 0
ElseIf Cells(i, 1) > Cells(i, 2) Then
Cells(i, 3) = 1
ElseIf Cells(i, 1) < Cells(i, 2) Then
Cells(i, 3) = 2
End If
End If
If Cells(i, 1) = 0 Then
If Cells(i, 1) = Cells(i, 2) Then
Cells(i, 3) = 0
ElseIf Cells(i, 1) < Cells(i, 2) Then
Cells(i, 3) = 1
End If
End If
End If
Next
End Sub
|
|