vba - Compare and count consecutive data in Excel -
i trying make excel macro compare , count data same column.
specifically, want count if cell , cell below cell both have absolute value less 100.
end goal: column below data have,
241.197 96.747 88.325 156 53.666 55.372 -45.667 -207.152
i want macro return value of 2. need count [96.747 88.325]
&
[53.666 55.372 -45.667]
say have column data starting @ a1
sub counttotal dim integer dim sum double dim count integer = 1 cells(rows.count, "a").end(xlup).row sum = abs(range("a" & i).value) + abs(range("a" & + 1).value) if sum < 100 count = count + 1 next msgbox count end sub
not tested. should see if counts last value in column + empty 1 after, if does, shorten loop 1.
Comments
Post a Comment