davidb
davidb

Reputation: 11

Copy duplicate rows from 2 columns Excel VBA

I have a worksheet with 3 columns (A,B,C).

I want to check for duplicates between column A and C If a cell value in A matches a cell value in C then I want to copy B in that row to another location (let's say column E).

The cells are located in different rows on columns A and C. The copy from B column needs to be on the same row as the duplicate on A, not on C.

How can I do this with Excel VBA? Thanks a lot!

Upvotes: 1

Views: 302

Answers (1)

Ryan Wildry
Ryan Wildry

Reputation: 5677

Perhaps you can use a formula like:

=IF(COUNTIF(C:C,A1)>0,B1,"")

It should give you what you want. Put that in column E, and copy it down for what you need.

Upvotes: 1

Related Questions