I have to perform a tricky sorting problem in Excel for a stock trading company.
First sort is by Sell / Buy (only two options)so quite easy.
Second sort is by numeric Company code (each listed company has a 4 digit code e.g AOL = 4568, Microsoft = 5685, etc). This is the tricky part. Often these shares a bought in one trade and other times in multiple trades.
I have to sort the multiple trades first follwed by the single trades.
This is an example of how the finished product would look.
Buy/Sell Company Code
S 5684
S 5684
S 5684
S 3256
S 3256
S 3256
S 4582
S 1568
S 5255
B 2260
B 2260
B 2260
B 2260
B 3333
B 3333
B 3333
B 1098
B 9856
B 8506
Anyone with ideas about how to sort in this fashion. I was thinking of first sorting by Buy and Sell and putting each goup in a new worksheet then going through row by row and comparing if the Buy/Sell and code is same as the row below. if it is a single trade cut it and placing at after the final row and working through each worksheet like that. Finally pasting the sorted buys after the sorted sells so it looks like the example above. This seems horribly clumsy but I cant think of any other good ideas.
voodoo
First sort is by Sell / Buy (only two options)so quite easy.
Second sort is by numeric Company code (each listed company has a 4 digit code e.g AOL = 4568, Microsoft = 5685, etc). This is the tricky part. Often these shares a bought in one trade and other times in multiple trades.
I have to sort the multiple trades first follwed by the single trades.
This is an example of how the finished product would look.
Buy/Sell Company Code
S 5684
S 5684
S 5684
S 3256
S 3256
S 3256
S 4582
S 1568
S 5255
B 2260
B 2260
B 2260
B 2260
B 3333
B 3333
B 3333
B 1098
B 9856
B 8506
Anyone with ideas about how to sort in this fashion. I was thinking of first sorting by Buy and Sell and putting each goup in a new worksheet then going through row by row and comparing if the Buy/Sell and code is same as the row below. if it is a single trade cut it and placing at after the final row and working through each worksheet like that. Finally pasting the sorted buys after the sorted sells so it looks like the example above. This seems horribly clumsy but I cant think of any other good ideas.
voodoo