Updated a database and deleted appropriate records - if no change, delete new record / if change, delete old record

abuchanan

New Member
Joined
Jan 25, 2014
Messages
49
So I have a dataset that is updated once a month from a different department (I am not pulling the data, so I kind of have to take what I can get!)

Each month, they run a report that dumps all records. Most of the records from one month to another month aren't touched, so no change. But there is no marker that tells me if there is a change. So I have to compare the "new" dump with the "old" dump and then delete records where no change has taken place. But the kicker is that in my database, I have added info to all records (shown in the Green Columns, G, H, I -- (This is for some class offerings at a school.)

BTW, I'm on a MAC, and for some reason I have problems getting the XL2BB addin to work... Sorry... know that would be easier!

So an example:
GREEN COLUMNS... This is data I have added and that does not exist in the dumps I receive.

BLUE: I receive an entire dump each time. So when I append files, I have tons of records that are duplicated.
BLUE STRIKE THROUGH ... these are the duplicate records that have had no change... they just need to be deleted.
BLUE RECORDS NO STRIKE THROUGH ... these are the "almost" duplicate records... but note the time changes in red. So what needs to happen is my green columns need to be copied to the "almost" duplicate record, and then the old record deleted.

Hope this makes sense.

My approach is that I think I need to add a column in the dump that has "dump date" in it. Then when I append, I can tell what is an old versus new record.
I also need to add a FLAG to my Master File which is a Delete Indicator (just tells me that the record needs to be deleted)

Then I can compare the Class Date, Start Time, End Time, Class Name and see if there are any changes... if there are no changes, I can turn on the delete flag. If there are changes, I need to copy the Green Columns to the new record and then turn on the delete flag for the old record. But doing this is another story!!! I'm not sure how to set up my macro, how to do the compare (assume with a concate?) and then how to set flags and delete...

Again, sorry for the long post and the confusions... I'm betting that I have explained this so great, so probably questions...


Col A. Col B Col C Col D Col E Col F Col G Col H. Col I
Class # Session Date Start End Class Name Instructor. Asst Instr Material Notice
550​
Thursday, July 30, 2020​
6:00 PM​
8:00 PM​
Leading Projects through ExecutionShane TomOrdered
550
Thursday, July 30, 2020
6:00 PM​
8:00 PM​
Leading Projects through ExecutionShane
620​
Thursday, July 30, 2020​
6:30 PM​
9:30 PM​
HR LawKelley Jack
620
Thursday, July 30, 2020
6:30 PM​
9:00 PM
HR LawKelley
Friday, July 31, 2020​
612​
Saturday, August 1, 2020​
9:00 AM​
1:00 PM​
Lean Six Sigma Green Belt CertificationIan Ann
612
Saturday, August 1, 2020
9:00 AM​
1:00 PM​
Lean Six Sigma Green Belt CertificationIan
Sunday, August 2, 2020​
Monday, August 3, 2020​
781​
Monday, August 3, 2020​
12:00 PM​
6:00 PM​
(Amazon) Continuous Improvement ChampionShane TomOrdered
782​
Tuesday, August 4, 2020​
9:00 AM​
5:00 PM​
(Amazon) Lean Six Sigma Yellow Belt CertificationShane
616​
Tuesday, August 4, 2020​
6:30 PM​
9:30 PM​
Employee Relations and Equal Employment OpportunityLinda AnnOrdered
616
Tuesday, August 4, 2020
7:30 PM
9:30 PM​
Employee Relations and Equal Employment OpportunityLinda
658​
Wednesday, August 5, 2020​
1:00 PM​
3:00 PM​
(OneBlood) Continuous Improvement FundamentalsShaneTom
658
Wednesday, August 5, 2020
1:00 PM​
3:00 PM​
(OneBlood) Continuous Improvement FundamentalsShane


So you can see where the new dump has been added in (i.e. each record is basically duplicated - new records are in blue). Classes 550, 620, 612, 616, 658 were in the OLD dump and are also in the new dump. However, 620 and 616 have been changed... not the start time and end times of these two classes. Also note that 781 and 782 are classes that have been added (they are new records in the new dump). -- don't have to worry about these.


So I need to delete the blue records for 550, 612, 658 (ones with the strike through).

For the two classes that have had their times changed (620 and 616), I need to copy the old green data to the new record and then delete the old record.

Thanks for any help with this confusing thing! It would be much easier if they could just supply me with records that have changed!!!! But getting them to do that is more difficult then doing this believe it or not! :)
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top