How to pull unique records and specific record changes from two snapshots of the same database into a third sheet
Hi y'all! I'm working with a large database of around 7500 records, with unique data spread across 100 columns per record. I'd like to take a snapshot of the database at regular intervals, and compare those snapshots across two intervals to get a list of:
- any records that have had any of their values change (sometimes a number, most often a unique text string)
- any new records that have entered the database since the last snapshot
- any records that have left the database since the last snapshot
I've found a solution that works if I take two snapshots on the same day, such that there wouldn't be any records leaving or entering the database (as records entering or leaving only updates once overnight). But I'd like to be able to compare across longer intervals as well, hoping to generate a weekly and monthly snapshot. Ideally, there would also be a way to highlight the specific column values that changed between the two snapshots, but I know that may be a separate problem entirely. Below is an example:
There are no dates associated within any given record, so I can't gauge which ones are newly added or leaving between snapshots by filtering the columns specifically.
My solution for comparing these snapshots on the same day works fine since the number of records is exactly the same. My formula for this is:
=IF(AND(EXACT(Post!2:2,Pre!2:2)),"",IF(NOT(ISBLANK(Post!2:2)),Post!2:2,""))
My understanding is that this formula will first check that all values in row 2 are the same across the "Pre" snapshot and the "Post" snapshot, and if they are exactly equal it will output a blank string. If they aren't exactly equal across all values, it will output the "Post" snapshot, while also making sure to output empty values as empty, rather than automatically filling them with 0s.
This formula won't work for longer intervals between snapshots as the number of records change. Essentially, I'm trying to figure out a way to compare each individual record (which each have their own unique ID number) to each other, outputting any records that have changed values during the interval and outputting any new records that have entered or left the database (and therefore don't have a comparison point in the other snapshot). Ideally, I could also set up some conditional formatting for those outputs, but its most important to just get the output pulling correctly first.
I'd love a solution that does not involve VBA (but I completely understand if that's the only way to do something like this)! Thank you!
[link] [comments]
Want to read more?
Check out the full article on the original site