Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing contents - is it possible
I receive two files at the end of each month.
One called "Tracking" has a list of all changes to all invoices (some invoices have actually been invoiced and others are still in progress), the other just has the invoices called "Invoices" (just the invoices that have been finalized). These are sent automatically at the end of the month from an SQL server. For some reason the invoices file is now coming with duplicates in it. I have asked the people who send this to me to remove the duplicates but they say they can't change the SQL on their end. (I thought SQL is supposed to be flexible enough to make changes to queries?????). I thought I could just delete the duplicate invoice numbers, but found out that the values are not equal in some cases so I have to go to the "Tracking" spreadsheet to find the most recent change and keep that copy of the Invoice. The question: Is it possible to compare the most recent change in the "Tracking" spreadsheet to the "Invoices" spreadsheet, then delete the duplicate records in the "Invoices" spreadsheet. Currently, I delete all the extra changes in "Tracking" so that I am only seeing the most recent of Invoice changes. Then I am going Invoice Number by Invoice Number and comparing values to the "Invoices". Once I have no duplicates in the "Invoices" file, it gets uploaded into Access for further manipulation. The only reason I noticed this is because in Access, some of the Invoice values were doubled because the invoices were "summed" during the upload phase in Access. Any suggestions would be great. Thanks, Lynn |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing contents - is it possible
I am sure you can do that, but you haven't given enough clear information to
give any specific advice. You can check out Chip Pearson's pages on dealing with duplicates: http://www.cpearson.com/excel/duplicat.htm more important, however, it the fact that you are getting flawed data. If they can't change the SQL, then you need to find out who can. How do you know the information you are getting is even correct? You should not have to search very far to find someone who will both be interested in the problem and have the power to get it corrected. You are trying to mask the symptoms, but someone needs to treat the disease. -- Regards, Tom Ogilvy "Lynn A." wrote in message om... I receive two files at the end of each month. One called "Tracking" has a list of all changes to all invoices (some invoices have actually been invoiced and others are still in progress), the other just has the invoices called "Invoices" (just the invoices that have been finalized). These are sent automatically at the end of the month from an SQL server. For some reason the invoices file is now coming with duplicates in it. I have asked the people who send this to me to remove the duplicates but they say they can't change the SQL on their end. (I thought SQL is supposed to be flexible enough to make changes to queries?????). I thought I could just delete the duplicate invoice numbers, but found out that the values are not equal in some cases so I have to go to the "Tracking" spreadsheet to find the most recent change and keep that copy of the Invoice. The question: Is it possible to compare the most recent change in the "Tracking" spreadsheet to the "Invoices" spreadsheet, then delete the duplicate records in the "Invoices" spreadsheet. Currently, I delete all the extra changes in "Tracking" so that I am only seeing the most recent of Invoice changes. Then I am going Invoice Number by Invoice Number and comparing values to the "Invoices". Once I have no duplicates in the "Invoices" file, it gets uploaded into Access for further manipulation. The only reason I noticed this is because in Access, some of the Invoice values were doubled because the invoices were "summed" during the upload phase in Access. Any suggestions would be great. Thanks, Lynn |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing contents - is it possible
"Tom Ogilvy" wrote in ...
more important, however, it the fact that you are getting flawed data. If they can't change the SQL, then you need to find out who can. The OP saying, 'they can't change the SQL on their end' may mean, 'they lack the knowledge required to change the SQL on their end'. I've been looking at some code this week where sql was used to get the whole (ordered) data set then VBA was used to loop through the rows to copy the required data to an array. My approach would be to write sql to fetch the data set as required in one hit but it would need a quite complex query. I'm up for the challenge (when time allows <g) but perhaps the OP's situation is the sql guy couldn't come with the goods so said, 'Here *all* the data, filter it in Excel.' The question: Is it possible to compare the most recent change in the "Tracking" spreadsheet to the "Invoices" spreadsheet, then delete the duplicate records in the "Invoices" spreadsheet. No doubt. Using sql on the Excel data, one can't DELETE rows but one can create a new data set (e.g. a new worksheet) by making an INNER JOIN between the two sheets using the common key and using either a subquery or a GROUP BY (using MAX(<<date_column) as the criteria) to get the most recent rows. As Tom said, you need to post more details. Jamie. -- |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing contents - is it possible
Thanks for your quick responses. I hope this is enough detail to my
issue. I get two files from the server e-mailed monthly. I delete all but the most recent transaction record for each invoice in the "Tracking" workbook. This leaves me with the final changes that occured for each Invoice. This does not have any billing amounts on it but it does have the last date of changes on it. I sort it by invoice number. Next I split my screen and look at each line in the "Invoices" workbook. For any invoice that has duplicates, I look at the "Tracking" workbook and I match the line that has the same invoice status as the most recent change in the "Tracking" workbook. All the billing information is in the "Invoices" workbook. Once clean, the "Invoices" workbook is uploaded into Access to do budgeting analysis in a third party product. Unfortunately, all the columns aren't the same between the two workbooks so I can't use the Compare workbooks that I found referenced several times in the archives. I have a little macro that identifies the duplicates in the "Invoices" workbook so I'm only having to look through about 150 records of 5000. Could I run a loop or something? For each duplicated record in the "Invoices" workbook, goto the "Tracking" workbook, lookup the invoice number, find the invoice status value, match the invoice status value, delete the other occurences of that invoice number. Is this descriptive enough? The person who will be taking this responsibility over, doesn't have much excel experience and I can see them getting really frustrated with the process. I don't mind it, in takes me about an hour or so to clean the data depending on how many duplicates are there, it would be nice to click a button and have all of the steps done and import the data immediately. I have given up trying to get the source to fix the problem. Not very friendly. Anything you can suggest is greatly appreciated. I have about a week to work this through before I turn it over to the other person. Thanks, Lynn (Jamie Collins) wrote in message . com... "Tom Ogilvy" wrote in ... more important, however, it the fact that you are getting flawed data. If they can't change the SQL, then you need to find out who can. The OP saying, 'they can't change the SQL on their end' may mean, 'they lack the knowledge required to change the SQL on their end'. I've been looking at some code this week where sql was used to get the whole (ordered) data set then VBA was used to loop through the rows to copy the required data to an array. My approach would be to write sql to fetch the data set as required in one hit but it would need a quite complex query. I'm up for the challenge (when time allows <g) but perhaps the OP's situation is the sql guy couldn't come with the goods so said, 'Here *all* the data, filter it in Excel.' The question: Is it possible to compare the most recent change in the "Tracking" spreadsheet to the "Invoices" spreadsheet, then delete the duplicate records in the "Invoices" spreadsheet. No doubt. Using sql on the Excel data, one can't DELETE rows but one can create a new data set (e.g. a new worksheet) by making an INNER JOIN between the two sheets using the common key and using either a subquery or a GROUP BY (using MAX(<<date_column) as the criteria) to get the most recent rows. As Tom said, you need to post more details. Jamie. -- |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing contents - is it possible
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Comparing cell contents via VB | Excel Discussion (Misc queries) | |||
Comparing Cell Contents in 2 or More Columns | Excel Discussion (Misc queries) | |||
Comparing Field Contents | Excel Discussion (Misc queries) | |||
Comparing cell contents with different reference cells | Excel Worksheet Functions | |||
Comparing Workbook contents | Excel Discussion (Misc queries) |