Sort for data in 2 columns

Rob-UK

New Member
Joined
Dec 18, 2011
Messages
19
Office Version
  1. 365
Platform
  1. Windows
I feel like I've been through 100's of threads trying to find this answer but apologies if Ive missed it!

I have a scoresheet for a quiz. As there are 40 teams, and I want to show the scoreboard on a landscape sized screen, I have split the data for the first 20 teams in columns B-J and the 2nd twenty in columns L to T

The TOTAL POINTS columns are therefore columns J and T. ( J4:J23 and T4:T23 )

I want a macro that will ( when linked to an active control button in A1 which I've created) sort all teams data into descending order based on the TOTAL POINTS column (s)

Is that possible?! I have seen ways to do multiple sorts of data but not one sort on data in 2 columns.

Hope that makes sense.

Screenshot of sheet.PNG
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
What Excel version are you using? I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What Excel version are you using? I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Sorry. Im on 365 ( build 16924.20150 Click-to-Run)
 
Upvote 0
Im on 365
Thanks for updating.

For the future, also investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

Could you use something like this? I've used a smaller sample with 10 teams.

Maintain the main scoreboard somewhere in one set of columns as I have below in B10:J20 and for display, use two formulas to sort and split the scoreboard as I have in the top section.

Rob-UK.xlsm
ABCDEFGHIJKLMNOPQRST
1
2Team123456TotalTeam123456Total
3Team 61817148181388Team 1272095245
4Team 10162107151767Team 414361538
5Team 38721871961Team 575127729
6Team 81124951748Team 719120
7Team 2898128247Team 9235
8
9
10Team123456Total
11Team 1272095245
12Team 2898128247
13Team 38721871961
14Team 414361538
15Team 575127729
16Team 61817148181388
17Team 719120
18Team 81124951748
19Team 9235
20Team 10162107151767
Sheet1
Cell Formulas
RangeFormula
B3:J7B3=LET(v,TAKE(SORT(B11:J20,9,-1),5),IF(v="","",v))
L3:T7L3=LET(v,TAKE(SORT(B11:J20,9,-1),-5),IF(v="","",v))
J11:J20J11=SUM(C11:H11)
Dynamic array formulas.
 
Last edited:
Upvote 0
Thanks Peter ! That is a solution. I was hoping I could enter straight into the scoreboard without needing a 2nd data table below however at this point, I am truly grateful to get anything working !!

So I've pasted the data for the 40 teams below the scoresheet covering B28:J67
Then I've adapted your formulae from =LET(v,TAKE(SORT(B11:J20,9,-1),5),IF(v="","",v)) to =LET(v,TAKE(SORT($C$4:$J$23,9,-1),20),IF(v="","",v)) applied to cells C4:J23 ( the first half of the pretty scoreboard) but am getting #SPILL!
I am assuming that the 9 in your formulae is the number of columns the data spans , -1 no idea(!) and the 5 the number of rows I am displaying the scoreboard data on. I obviously got something terribly wrong :(
 
Upvote 0
but am getting #SPILL!
Clear all cells in C4:J23 & then use this formula in C4 only
Excel Formula:
=LET(v,TAKE(SORT(B28:J67,9,-1),20),IF(v="","",v))
 
Upvote 0
Then I've adapted your formulae
Yes, you have adapted the formulas incorrectly. It relates mainly to the range that you have pointed it at. @Fluff is on to that but I think that the formula should be in column B to emulate your post 1 image.

So, here it is again with the full 40 teams. There are only 2 formulas entered in the top section. Cells B4 and L4. Excel will automatically 'spill' all the other results to the cells in rows 4:23 so don't drag the formula across or down.

Rob-UK.xlsm
ABCDEFGHIJKLMNOPQRST
3Team123456TotalTeam123456Total
4Team 61817148181388Team 23416323
5Team 40162107151767Team 31321722
6Team 38721871961Team 3719120
7Team 2620141111359Team 91818
8Team 3419182057Team 1821416
9Team 291681151454Team 2442915
10Team 381124951748Team 3572615
11Team 2898128247Team 1494114
12Team 1272095245Team 1931114
13Team 25931214745Team 361414
14Team 28671021843Team 71212
15Team 3079617342Team 11333312
16Team 414361538Team 101010
17Team 2713694335Team 39235
18Team 221215532Team 80
19Team 32771832Team 120
20Team 33920231Team 130
21Team 575127729Team 150
22Team 1720626Team 160
23Team 20151126Team 210
24
25
26
27Team123456Total
28Team 1272095245
29Team 2898128247
30Team 38721871961
31Team 414361538
32Team 575127729
33Team 61817148181388
34Team 71212
35Team 80
36Team 91818
37Team 101010
38Team 11333312
39Team 120
40Team 130
41Team 1494114
42Team 150
43Team 160
44Team 1720626
45Team 1821416
46Team 1931114
47Team 20151126
48Team 210
49Team 221215532
50Team 23416323
51Team 2442915
52Team 25931214745
53Team 2620141111359
54Team 2713694335
55Team 28671021843
56Team 291681151454
57Team 3079617342
58Team 31321722
59Team 32771832
60Team 33920231
61Team 3419182057
62Team 3572615
63Team 361414
64Team 3719120
65Team 381124951748
66Team 39235
67Team 40162107151767
Sheet3
Cell Formulas
RangeFormula
B4:J23B4=LET(v,TAKE(SORT(B28:J67,9,-1),20),IF(v="","",v))
L4:T23L4=LET(v,TAKE(SORT(B28:J67,9,-1),-20),IF(v="","",v))
J28:J67J28=SUM(C28:H28)
Dynamic array formulas.


I am assuming that the 9 in your formulae is the number of columns the data spans
Not quite, although you certainly do have 9 columns. The 9 is telling the formula to sort all the columns based on the 9th column of the range. Since the range is columns B:J, the 9th column of that is column J (Total)


-1 no idea(!)
The -1 is telling the formula to sort the totals from Highest to Lowest (not the default Lowest to Highest)


the 5 the number of rows I am displaying the scoreboard data on
Correct. It is saying to take the first 5 rows of the sorted data. The -5 in the second formula was saying to take the last 5 rows of the sorted data.


I was hoping I could enter straight into the scoreboard without needing a 2nd data table below
Not quite sure what the issue there is but another possibility may be to have the data entry table on one worksheet and the rearranged (sorted) results on another worksheet for display purposes?
 
Upvote 1
Solution
You are A M A Z I N G !!! I am always impressed with what Excel can do, with the right knowledge and skills, which you, and so many on this site obviously possess! the scoreboard works a treat, and the large charity quiz I am using it for on Saturday will be so much better for it, so thank you :)
 
Upvote 0
You're welcome. Glad we could help. Thanks for the follow-up. :)
Good luck with the charity quiz! 💲💲
 
Upvote 0

Forum statistics

Threads
1,215,094
Messages
6,123,071
Members
449,092
Latest member
ipruravindra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top