Hey, All.
Short-Story:
I need to check an array for duplicate entries, add an element with the count of same entries and sum the value of another field for those entries.
e.g.
Input Array:
Event Qnty
ID011 1302
ID012 1738
ID012 1104
ID013 1659
Output Array:
Event # Qnty
ID011 1 1302
ID012 2 2842
ID013 1 1659
*Note* I'd rather not do this with formulas, I don't know anything about collections, and we do not have approval for the reference addition that seems required to use dictionaries (which I also know nothing about). So, for better or for worse, an array based solution is the best option for me.
Novella:
I'm trying to help a co-worker with a big daily menial task. We get e-mailed a spreadsheet from our customer every morning with data on their sales events, the products involved, and how many of each product are in-stock. My co-worker manually copies each Event ID and Event Dates in to another workbook and adds the count and sum of products involved. This is then e-mailed to our distribution centers for planning purposes. I'm working on a macro to automate this process.
The biggest portion of my question is really just what would be a good way to go about this process.
My plan, presently, is to have them open a 3rd workbook that contains the macro with a button assigned to the macro. The macro would then open their workbook and our workbook. Then it would check the range of data in their worksheet and assign it all to an array. Then I would loop through the array using a 'For...Next' statement; testing for duplicates, adding an element to hold the count and sum as I go. I also need to flag Event IDs that are already in our workbook, check the new data against the existing data, and highlight fields where the data has changed. My plan at this point is creating two temporary arrays to hold new event data and existing event data so that I can then test an
So, I've been at this all week already and it still feels beyond my grasp.
I've gotten the variables set up to deal with the date change in the filename, tested for the files existance, opened it, copied the entire range into and array, and tested just writing out the un-de-duped array to the other workbook as append to the last row of existing data. Now I need the looping, de-duping, counting, and summing.
At this point, I'm pretty sure arrays and looping give me writers block.
Thank you, in advance, for your time and any assistance you may offer.
Short-Story:
I need to check an array for duplicate entries, add an element with the count of same entries and sum the value of another field for those entries.
e.g.
Input Array:
Event Qnty
ID011 1302
ID012 1738
ID012 1104
ID013 1659
Output Array:
Event # Qnty
ID011 1 1302
ID012 2 2842
ID013 1 1659
*Note* I'd rather not do this with formulas, I don't know anything about collections, and we do not have approval for the reference addition that seems required to use dictionaries (which I also know nothing about). So, for better or for worse, an array based solution is the best option for me.
Novella:
I'm trying to help a co-worker with a big daily menial task. We get e-mailed a spreadsheet from our customer every morning with data on their sales events, the products involved, and how many of each product are in-stock. My co-worker manually copies each Event ID and Event Dates in to another workbook and adds the count and sum of products involved. This is then e-mailed to our distribution centers for planning purposes. I'm working on a macro to automate this process.
The biggest portion of my question is really just what would be a good way to go about this process.
My plan, presently, is to have them open a 3rd workbook that contains the macro with a button assigned to the macro. The macro would then open their workbook and our workbook. Then it would check the range of data in their worksheet and assign it all to an array. Then I would loop through the array using a 'For...Next' statement; testing for duplicates, adding an element to hold the count and sum as I go. I also need to flag Event IDs that are already in our workbook, check the new data against the existing data, and highlight fields where the data has changed. My plan at this point is creating two temporary arrays to hold new event data and existing event data so that I can then test an
So, I've been at this all week already and it still feels beyond my grasp.
I've gotten the variables set up to deal with the date change in the filename, tested for the files existance, opened it, copied the entire range into and array, and tested just writing out the un-de-duped array to the other workbook as append to the last row of existing data. Now I need the looping, de-duping, counting, and summing.
At this point, I'm pretty sure arrays and looping give me writers block.
Thank you, in advance, for your time and any assistance you may offer.