Link to home
Start Free TrialLog in
Avatar of montrof
montrofFlag for United States of America

asked on

Add a Value for first value in Column

I need a macro that would assign a 1 to the first value and a 0 to each additional value that is the same. IE

Apple  1
Apple  0
Apple  0
Orange 1
Banana 1
kiwi 1
Banana 0

Searching Column E and Put the value in Column N start at row 2.

Thanks,
Montrof
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

No need for VBA

=IF(COUNTIF($E$2:$E2,$E2)=0,1,0)

Copied down as far as required.

Thanks
Rob H
@Rob

If I am not wrong, tt should be like this.....

=IF(COUNTIF($E$2:$E2,$E2)=1,1,0)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of montrof

ASKER

This is perfect Thank you so much!!
You're welcome. Glad it worked as per your requirement. :)
Sktneer - correct, I omitted to offset by a row to count the cells above.