Edited my OP to create the new list a bit differently than I originally thought.
Hello KM. This post is an offshoot from a question I had last week here...
I thought I should start a new thread about it. I want to take a list of data and determine which of Variable A occurs the most but not by how often it appears in list but in total of the sum of the differences of Variable B and Variable C. I think my example below will make more sense than this explanation. As always thank you to the community.
An example data set here....
Variable A, Variable B, Variable C
SK BDC ,178554794,178964282
BDC JON,179082914,179792677
2016030,197931059,201932474
AA01810,213695710,215268068
C104680,215964577,216426614
AA01800,216478686,216925439
AA01790,221589474,222058260
C104680,222115649,222154462
AA01790,222162764,222197257
AA01800,222209339,222605901
AA01790,222647684,222883717
AA01800,222883717,222888307
AA01790,222888307,222934005
AA01800,222934005,222939824
SK BDC ,178554794,178964282
BDC JON,179082914,179792677
2016030,197931059,201932474
AA01810,213695710,215268068
C104680,215964577,216426614
AA01800,216478686,216925439
AA01790,221589474,222058260
C104680,222115649,222154462
AA01790,222162764,222197257
AA01800,222209339,222605901
AA01790,222647684,222883717
AA01800,222883717,222888307
AA01790,222888307,222934005
AA01800,222934005,222939824
So for example in the first line....
SK BDC ,178554794,178964282
The difference between Variable B and C, or the calculation 178964282 - 178554794 = 409488, would be determined to be 409488 (which Ill refer to as Variable D). The macro would then find every time Variable A appeared in the list and add up that variable D to a final number. So a simple example would be if it found SK SDB five times and each had a variable D of ten the final number of variable D would be fifty. This is a simplified example since as you can see in my provided data set below variable D will most like be in the millions at the end.
Then the last step would organize the list from the highest Variable D to the lowest Variable D so it would look something like...
AA01790, 35032456
AA01800, 33053213
SK BDC , 27033044
BDC JON, 191030940
Here is the more complete data set....
Billy Hicks data set.kmmacros (3.6 KB)