98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel Training and help » Deleting Duplicate Results when matching tables of data.
Deleting Duplicate Results when matching tables of data.
Resolved · Urgent Priority · Version 2007
Jordan has attended:
Access VBA course
Deleting Duplicate Results when matching tables of data.
Hello,
I have an excel problem. Basically, we have data that gets imported on a daily basis into excel via various sources, these new tables of data need to be matched against previous "ALL CASES" data. For example, I will import data for UK into UK sheet. I want to then copy all the data from UK sheet into all cases, and then from this new "ALL CASES" data, i want to remove any values where they match on two different criteria, for example if Part Number and Identification Number are both equal, then remove the older duplicate. Currently the process is very slow and prone to errors. We copy UK DATA into a new sheet, then colour all cells yellow, then copy ALL CASES data into the new sheet, then sort by Part Number and Identification number, and if there is any duplicates (matched on both columns). Then we delete the non-coloured one. Then when this is done, we copy back into all cases. However, as this is only 1 of the 10ish countries we have to do it for.. it takes a long time, and we are looking to automate the process. Hope this helps... Please can you provide any possible solution.
RE: Deleting Duplicate Results when matching tables of data.
Hi Jordan
Thanks for getting in touch. There are two methods I can foresee to achieve this, based on the info you have provided.
The first is a VBA solution. As you have attended Access VBA you can probably get around Excel VBA, in which case sorting and filtering can get pretty processor-intensive in your code.
You should try direct cell manipulation, along these lines:
For ColumnCount = 2 To 10
'Destination row
Sheets("UK DATA").Cells(1, ColumnCount - 1).Value = _
Sheets("ALL CASES").Cells(9, ColumnCount).Value
' = Source row
Next intColumnCount
This assumes your data is 10 columns wide, and "exports" the data from one cell to another, in a relative fashion. This is about the fastest way you can transfer data across sheets. You would wrap this phrase in an IF statement to decide whether you were going to copy or not.
Secondly you can probably find really powerful and simple ways to do this with PivotTables. You can build the table as required, then drag the field that contains the region / area (e.g. "UK") into the Report section. Once you have done this you can go to the PivotTable menu, PivotTable Options then Show Pages. This will create a separate page for each region.
Consider these options and see what works best for you. Let me know if you need further guidance.
Kind regards
Gary Fenn
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
RE: Deleting Duplicate Results when matching tables of data.
Hi Gary, thanks for the prompt response!
Not sure if it solves my problem I will try to be slightly more clear. I have Several sheets all called by the country as follows...:
Germany, France, Finland, Hungary, Ireland, Norway, Netherlands..and so on.
These sheets get updated everyday, but they also need to be inserted into All Cases, as a sort of history of each case.
Each case in each of the seperate sheets needs to be compared with every case on the ALL Cases sheet. This comparison should be made on PRN and IN (two seperate criteria). Then delete or overwrite a case if it appears in any of the (updates) country sheets.
A VBA solution would be ideal to be honest as I will not be running the tool once completed, only if problems occur!
RE: Deleting Duplicate Results when matching tables of data.
Hi Jordan
Thanks for your reply. Given the detail you've provided, a VBA solution that takes the approach I listed above should definitely work.
You will be comparing your two cells with an IF statement, and exporting the data as previously described.
Kind regards
Gary Fenn
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
RE: Deleting Duplicate Results when matching tables of data.
Hello. I have recently had a meeting and the angle of the task has now changed. Basically, what I am trying to do now is...
If value in sheet (GB).range B:B, is equal to sheet (alll Cases).range(B:B) value...
Then see if GB.range (O:O), is equal to (All Cases) range(H:H) on the same row.
If they are both equal, then copy sheet(All Cases).range(I:R) to that row in GB where they match.
If they are not equal, then move to next record and loop through all the way.
For Example...
If Sheets(GB).Range(B2).value = Sheets(All Cases).Range(B34).value then
Check if Sheets(GB).Range(O2).value = Sheets(All Cases).range(H34)
If both contain equal value, then
All Cases.Range(I34:R34).Copy
and paste into GB.Range(Q2:Z2)
I am hoping to get this in a loop to check every value in GB(B:B) against ALL Cases(B:B), if the value in GB(B2) doesn't appear in All Cases(B:B) then just move onto next value..
I hope that makes sense, I apologise for the mixed style of the above, but i am trying to make it more clear!
I look forward to hearing from you.
Best Regards
Jordan
RE: Deleting Duplicate Results when matching tables of data.
Hello Jordan,
I am writing to check if the issue you mentioned on the Best STL forum was resolved.
If it was, great. If it wasn't, we can (continue to) help if you let us know by responding to this message.
Kind regards
Cindy
Microsoft Office Trainer
Wed 28 Nov 2012: Automatically marked as resolved.
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Change the Default Width of All Columns in Excel 2010If you want to change the width of the columns in your Excel 2010 spreadsheet, making them either larger or smaller, here's how: |