I have one table with ten columns and each column has as a name the numbers from 1 to 10, in ascending order: 1,2,3,4,5,6,7,8,9,10.
On each row there are different values from 0 to 100+ which represents the numbers frequency, numbers been represented by each column name.
Job to do:
I want to get top X numbers which have the biggest values, for each row.
For example, the first row has:
1 2 3 4 5 6 7 8 9 10 <--- Column name (the numbers themselves).
8 0 4 9 7 6 6 1 5 6 <---values as frequency.
So, for this row I should get the following:
Top 3 numbers are: 4,5,1.
Which are, in fact, the column names and not the values from the rows but these column names are choose because they have the top 3 values from all this row, values been: 9,8 and 7.
Second, if you want top 4 numbers then we should get:
4,5,1,6,7,10. So, we get the column names as above because they have the top 3 values (9,7 and 8) + 4rd value which is 6 and on this row 6 is found on 3 cells, that is why we get 3 column names (numbers) instead: 6,7 and 10.
How to do this ?
Please help !
Thank you !
Bookmarks