View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Stefan Jansson Stefan Jansson is offline
external usenet poster
 
Posts: 2
Default Compare databases

Hi and thanks!
I had an idea about Access and tried some, as I thought intelligent tricks,
but with no success, sorry to say. But, if you have a an Access solution I
would be more than happy to know about it. I use Access a lot too. Please,
let me know if you sit on a smart Access solution!

Regards
Stefan

"MSP77079" skrev i meddelandet
...

This is really a job for Access. But, I've done it in Excel as
follows:

I assume there is something unique about each record, such as customer
name, product name, sales territory.

I create a new sheet, which I name "temp".

On the new sheet, I create two lists ... one from each of the two
databases you want to compare. Each list is a concatenation of the
unique identifiers

.. "customer name" & "product name" & "sales territory"

then, I do a Match(list2, ThisItemInList1, 0)
to make this really robust, I use
MatchRow = if(iserror(Match(list2, ThisItemInList1,
0)),0,Match(list2, ThisItemInList1, 0))

If MatchRow 0 then
For j = 1 to LastColumnInDatabase
With Sheets("Database2").Cells(MatchRow, j)
If Sheets("Database1").Cells(RowOfThisItemInList1,j). Text <
Text then .Interior.Color = vbYellow
End With
Next j

After doing all of the comparisons, I run another macro that hides all
rows where there is no highlighted cells

then, delete the temp sheet


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/