On Duplicate, update record

M

MikeD1224

I have a table of data that has 4 columns:

Column A : Transaction Date
Column B: Prescription #
Column C: Date of Service
Column D: Amount Due

Using Column A, B & C I can identify unique records.

The file is organized chronologically by Transaction Date (column A).

I am trying to find a method by which I can write a macro or script to go
through the file and upon finding a duplicate record, remove all but the last
instance/occurrence.

Any help/ideas would be much appreciated.

Mike
 
D

Dave Peterson

I would insert a new column E.

I'd put this in E2 (headers in row 1, right?)

=text(a2,"mm-dd-yyyy")&"."&b2&text(c2,"mm-dd-yyyy")
and drag down as far as I needed.

Then in F2 (another helper column):
=IF(COUNTIF($E$2:E2,E2)=COUNTIF(E:E,E2),"keepme","delete me")
and drag down.

Then filter column F to show the deleteme's (after you do some minor checking).

And then delete the visible rows.

Then remove the filter and delete the two helper columns.

=======
If I needed a macro, I would do the same thing, but in code. In fact, I'd
record a macro when I did it manually to help build the code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top