I have subsets of data for stock symbols combined onto one spread sheet. Symbols are Column A and Performance is Column B. I want to choose the top 5 symbols of each subset based on performance, and list those stock symbols adjacent to the data. I can use the SORTN function to do this, however I need to instruct the range of cells being sorted to stop where one subset of data ends and a new one begins. I then want the SORTN function to continue to the next subset of data and pull the top 5 performers from that new subset. And so on, until top 5 performers have been pulled for all subsets of data.
Here is a sample sheet. Feel free to play around with this however you would like. https://docs.google.com/spreadsheets/d/1sJMOpK9on9Re4OGKhFQ3bHdOHGGhqv3FPQFjmZkvgr8/edit?usp=sharing
So as you can see on the sample sheet, there's currently a formula that sorts the top 5 values from a subset, and stops where the subset of data ends. However, I need a formula that would then continue automatically to the next subset of data and pull the top 5 performers of those; and so on and so on until top 5 performers have been pulled and sorted for every subset. The one I have currently I need to manually insert at the beginning of each subset, and adjust the rows within the formula accordingly. I cannot manually input a SORTN formula and adjust the rows for the formula each time a new subset begins, because in a real-world application I will most likely be working with 100+ subsets of data.
Just to reiterate: I need the SORTN formula to automatically know to stop sorting where one subset ends and the other begins (specifically where the cell value is "Symbol"); THEN, I need it to continue onto the next subset of data and sort the top 5 performers of that new subset; I would like it to continue down the entire list, sorting top 5 performers for each subset of data.
If I could combine the data horizontally I could make a SORTN function work much easier since the number of columns are identical in each subset of data, but I am combining .CSV files using terminal on my mac, and it seems that it only combines vertically.
I'm stuck here. Please let me know if there is anything I can do, and if I need to clarify for anybody kind enough to help.