A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Try this:
.
.
For Row = 2 To 7
Cells(Row, "A") = WorksheetFunction.CountIf(Range("B1:B" & Row), Cells(Row, "B")) > 1
Next Row
.
.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi! Warning - I'm an Excel VBA novice!
I would like to create a column which marks duplicate entries in another column, and I would like only the second occurrence marked. Example: Column B has entries (in rows 1-7): A,B,C,C,D,E,D. I want a mark in another column which marks rows 4 and 7 as being duplicates of earlier rows. How do I do this?
Using =COUNTIF($B$2:$B2, B2) >1 will mark TRUE for the second occurrence of any record with no problem. However, I don't want to drag that formula down more than 1,000 rows! The very simple macro I created marks "True" for each duplicate whereas what I would like would be True for only each second occurrence of data. This is what I was using for a smaller test data set. By the way, I'm using Mac Excel 2011.
Dim Row As Integer
For Row = 2 To 4
Cells(Row, "A") = WorksheetFunction.CountIf(Range("B2:B13"), Cells(Row, "B")) > 1
Next Row
Thanks in advance for your help and advice.
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Try this:
.
.
For Row = 2 To 7
Cells(Row, "A") = WorksheetFunction.CountIf(Range("B1:B" & Row), Cells(Row, "B")) > 1
Next Row
.
.
Absolutely Fabulous! Many, Many THANKS!!
Juliana