I have come into a dilemma with building a macro for a report. I will receive a large report which varies in size a few times a month. I cannot use the report I work with but I have created a sample to use for this issue and should be able to work the code into my report. Please be aware though, the report is much larger than this both in number of rows and columns.
The original will come in something like this:
Original
I then have to custom sort by: Customer (A), then by Product (B), and then Supplier(C):
Sorted
Once sorted, I will match the Sale Units in Column E to the Purchase Units in Column E. Once they equal 0, I insert a column and enter the sum function in (i, D) & (i,E):
Matching Transactions
All of the Purchased units on the report will have an equal amount of sale units per supplier (match). Disclaimer: out of the years I have been doing this, there have only been a small handful of time where there were leftover units (Column E did not =0). Also, no units from one supplier will ever be used for another.
One of the issues I am experiencing is sometimes there are 2,3,4, etc Sales which add up to the Purchase amount:
Multiple Sales
Another is when the customer will purchase and sell from the supplier(s) multiple times:
Busy Customer
Is anyone able to create a macro which could do all of the above? I have not done this before but I am hoping I can post the sample report for you all to actually see more of what I am referring to. I would really appreciate any help as you can imagine this could become quite tedious when there are hundreds of rows of data sometimes. If you have any questions, please let me know!
user26626035 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.