Sort list by size

Mrmath9

New Member
Joined
Jan 5, 2022
Messages
15
Office Version
  1. 2013
Platform
  1. Windows
Hi, i want to analyse a big amount of number and would love some help.

Column A = time
Column B = Price
Column C = Size

Aprox 200 000 rows :O

How can i sort this so the 20 biggest by size show up in Column D (biggest on top) followed by it´s time in Column E and it´s price Column F.

If i see big size at row 750, it would be great if i also could get the price for the previous (row 749) in Column G and the price for (row 751) in column H.

I want to see the 20 biggest by size like this.

Would this be possible? Hope you understand how i mean.
Can someone help me please, how can i code this?
I would appriciate it a lot. Even if you could just help with first section it would be great.
Best regards, thank you.
Dave.
 
That was it, now it works on one of my computors :D Good. I changed my regional settings to US. Is there any difference between formulas on older version excel or same should work? One thing i wonder though. Everything works know but clock is 0.625 instead of 15:00 :D Why?
Regarding formulas above formulas should work in Excel 2013
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
You can get the arrangement you want just by dragging the formulas around:

Book1
ABCDEFGHI
1TimePriceSizeTop 20 SizesTimePrev PricePriceNext PriceRow
21:00119249815:0014151616
32:0021514934:003455
43:00326849320:001920021
54:00449341719:0018192020
65:00512838317:0016171818
76:0061033809:00891010
87:00725337111:0010111212
98:00827229514:0013141515
109:00938029016:0015161717
1110:00101272728:007899
1211:00113712683:002344
1312:001222926218:0017181919
1413:00132012537:006788
1514:001429522912:0011121313
1615:001549820113:0012131414
1716:00162901921:00 122
1817:00173831512:001233
1918:00182621285:004566
2019:001941712710:009101111
2120:00204931036:005677
Sheet40
Cell Formulas
RangeFormula
D2:D21D2=LARGE($C$2:$C$100,ROWS($C$2:$C2))
E2:E21E2=INDEX(A:A,$I2)
F2:F21F2=IF(I2>2,INDEX($B:$B,I2-1),"")
G2:G21G2=INDEX(B:B,$I2)
H2:H21H2=INDEX($B:$B,I2+1)
I2:I21I2=AGGREGATE(15,6,ROW($A$2:$A$100)/($C$2:$C$100=$D2),COUNTIF($D$2:$D2,$D2))


As far as changing the formulas, in the D and I formulas, you have to change the range to have the maximum number of rows you want. 200,000 based on your original question. I'd recommend against making it the whole length of the sheet for performance reasons. Change it to something like 300,000. You don't need to change the formulas if you want the top 30 instead of the top 20, just drag them further down the columns.

You can get the arrangement you want just by dragging the formulas around:

Book1
ABCDEFGHI
1TimePriceSizeTop 20 SizesTimePrev PricePriceNext PriceRow
21:00119249815:0014151616
32:0021514934:003455
43:00326849320:001920021
54:00449341719:0018192020
65:00512838317:0016171818
76:0061033809:00891010
87:00725337111:0010111212
98:00827229514:0013141515
109:00938029016:0015161717
1110:00101272728:007899
1211:00113712683:002344
1312:001222926218:0017181919
1413:00132012537:006788
1514:001429522912:0011121313
1615:001549820113:0012131414
1716:00162901921:00 122
1817:00173831512:001233
1918:00182621285:004566
2019:001941712710:009101111
2120:00204931036:005677
Sheet40
Cell Formulas
RangeFormula
D2:D21D2=LARGE($C$2:$C$100,ROWS($C$2:$C2))
E2:E21E2=INDEX(A:A,$I2)
F2:F21F2=IF(I2>2,INDEX($B:$B,I2-1),"")
G2:G21G2=INDEX(B:B,$I2)
H2:H21H2=INDEX($B:$B,I2+1)
I2:I21I2=AGGREGATE(15,6,ROW($A$2:$A$100)/($C$2:$C$100=$D2),COUNTIF($D$2:$D2,$D2))


As far as changing the formulas, in the D and I formulas, you have to change the range to have the maximum number of rows you want. 200,000 based on your original question. I'd recommend against making it the whole length of the sheet for performance reasons. Change it to something like 300,000. You don't need to change the formulas if you want the top 30 instead of the top 20, just drag them further down the columns.
Hi Eric, it works great. I wonder. On my other computor i only have open office. Is there a way changing the code so it work in open office aswell? If so how?? I´m not sure if you guys are into open office aswell or just excel? :D Thank you.
 
Upvote 0
Well, I don't have Open Office, so I can't help with that. Undoubtedly there are some things that would transfer, but I don't know what. There are probably some people here that know Open Office who might help. I'd suggest you open a new thread in the "General Discussion and Other Applications" forum, and ask your question there. You might get a bite. Good luck!
 
Upvote 0
Well, I don't have Open Office, so I can't help with that. Undoubtedly there are some things that would transfer, but I don't know what. There are probably some people here that know Open Office who might help. I'd suggest you open a new thread in the "General Discussion and Other Applications" forum, and ask your question there. You might get a bite. Good luck!
It´s okey. Yes i will try opening new thread and see if someone know. Thanks anyway. :)

 
Upvote 0

Forum statistics

Threads
1,224,747
Messages
6,180,714
Members
452,995
Latest member
isldboy

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