Sub Maybe_A()
Dim i As Long
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i, 1).Value = Cells(i, 1).Offset(-1).Value Then Cells(i, 1).Value = 0
Next i
End Sub
Sub Maybe_B()
Dim i As Long
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i, 1).Value = Cells(i - 1, 1).Value Then Cells(i, 1).Value = 0
Next i
End Sub
Sub rival36()
With Range("A5", Range("A" & Rows.Count).End(xlUp))
.Value = Evaluate("if(" & .Address & "=" & .Offset(-1).Address & ",0, " & .Address & ")")
End With
End Sub
no i don't want to use helper columnPut this FORMULA in E5 if you want to use helper column to get what you want
=IF(A5=A4,0,A5)
I understandno i don't want to use helper column
m using some logic and i want that if previous cell having same value as current cell is should return zero in current cellI understand
Thanks for reply
Not working sir, I want to use excel formula and not VB,VBA Code:Sub Maybe_A() Dim i As Long For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1 If Cells(i, 1).Value = Cells(i, 1).Offset(-1).Value Then Cells(i, 1).Value = 0 Next i End Sub
VBA Code:Sub Maybe_B() Dim i As Long For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1 If Cells(i, 1).Value = Cells(i - 1, 1).Value Then Cells(i, 1).Value = 0 Next i End Sub