How to make automatic unique ranking table if changing only week number?

Sochen

Board Regular
Joined
Dec 6, 2022
Messages
66
Office Version
  1. 2021
Platform
  1. Windows
Hi All,

I have the excel below which I want to make a dynamic table.
1. The data in the table automatically change if change the week number
2. Only top 5 categories (unique) will be appear in the table base on the sales performance

Book1
ABCDEFGHIJKLMNOPQR
1
2Change the week number from Week 2 to Week 3 as the result will automatically change in the table below
3
4
5Week No.DateCategoriesSalesWeek No.2Week No.3
6211-Jan-23Apple$ 50.00Rank.CategoriesTotal SalesRank.CategoriesTotal Sales
7211-Jan-23Mango$ 25.001Apple$ 90.001Banana$ 80.00
8211-Jan-23Banana$ 15.002Dragon fruits$ 55.002Apple$ 75.00
9211-Jan-23Orange$ 10.003Watermelon$ 45.003Strawberry$ 70.00
10214-Jan-23Apple$ 40.004Banana$ 40.004Orange$ 65.00
11214-Jan-23Mango$ 30.005Mango$ 35.005Cherry$ 60.00
12214-Jan-23Watermelon$ 20.00
13214-Jan-23Papaya$ 75.00Note:Update the Week No. to see the sale performance of any week.
14215-Jan-23Dragon fruits$ 15.00Once changing the week number, then the categories and total sales will automaticallt change. And only the top 5 categories will appear on the table.
15318-Jan-23Cherry$ 60.00
16318-Jan-23Apple$ 75.00
17318-Jan-23Strawberry$ 70.00
18318-Jan-23Grapes$ 30.00
19318-Jan-23Durian$ 20.00
20318-Jan-23Orange$ 55.00
21318-Jan-23Banana$ 35.00
22318-Jan-23Pineaple$ 55.00
23319-Jan-23Orange$ 10.00
24319-Jan-23Banana$ 45.00
25
Sheet1
Cell Formulas
RangeFormula
A6:A24A6=ISOWEEKNUM(B6)
 
Last edited:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
How about
Fluff.xlsm
ABCDEFGHIJKLMNOPQR
1
2Change the week number from Week 2 to Week 3 as the result will automatically change in the table below
3
4
5Week No.DateCategoriesSalesWeek No.2Week No.3
6211-Jan-23Apple50Rank.CategoriesTotal SalesRank.CategoriesTotal Sales
7211-Jan-23Mango251Apple901Banana80
8211-Jan-23Banana152Papaya752Apple75
9211-Jan-23Orange103Mango553Strawberry70
10214-Jan-23Apple404Watermelon204Orange65
11214-Jan-23Mango305Banana155Cherry60
12214-Jan-23Watermelon20
13214-Jan-23Papaya75Note:Update the Week No. to see the sale performance of any week.
14215-Jan-23Dragon fruits15Once changing the week number, then the categories and total sales will automaticallt change. And only the top 5 categories will appear on the table.
15318-Jan-23Cherry60
16318-Jan-23Apple75
17318-Jan-23Strawberry70
18318-Jan-23Grapes30
19318-Jan-23Durian20
20318-Jan-23Orange55
21318-Jan-23Banana35
22318-Jan-23Pineaple55
23319-Jan-23Orange10
24319-Jan-23Banana45
Summary
Cell Formulas
RangeFormula
G7:I11G7=LET(u,UNIQUE(FILTER(C6:C200,A6:A200=H5)),TAKE(HSTACK(SEQUENCE(MIN(5,ROWS(u))),SORT(HSTACK(u,SUMIFS(D:D,A:A,H5,C:C,u)),2,-1)),5))
A6:A24A6=ISOWEEKNUM(B6)
Dynamic array formulas.
 
Upvote 0
How about
Fluff.xlsm
ABCDEFGHIJKLMNOPQR
1
2Change the week number from Week 2 to Week 3 as the result will automatically change in the table below
3
4
5Week No.DateCategoriesSalesWeek No.2Week No.3
6211-Jan-23Apple50Rank.CategoriesTotal SalesRank.CategoriesTotal Sales
7211-Jan-23Mango251Apple901Banana80
8211-Jan-23Banana152Papaya752Apple75
9211-Jan-23Orange103Mango553Strawberry70
10214-Jan-23Apple404Watermelon204Orange65
11214-Jan-23Mango305Banana155Cherry60
12214-Jan-23Watermelon20
13214-Jan-23Papaya75Note:Update the Week No. to see the sale performance of any week.
14215-Jan-23Dragon fruits15Once changing the week number, then the categories and total sales will automaticallt change. And only the top 5 categories will appear on the table.
15318-Jan-23Cherry60
16318-Jan-23Apple75
17318-Jan-23Strawberry70
18318-Jan-23Grapes30
19318-Jan-23Durian20
20318-Jan-23Orange55
21318-Jan-23Banana35
22318-Jan-23Pineaple55
23319-Jan-23Orange10
24319-Jan-23Banana45
Summary
Cell Formulas
RangeFormula
G7:I11G7=LET(u,UNIQUE(FILTER(C6:C200,A6:A200=H5)),TAKE(HSTACK(SEQUENCE(MIN(5,ROWS(u))),SORT(HSTACK(u,SUMIFS(D:D,A:A,H5,C:C,u)),2,-1)),5))
A6:A24A6=ISOWEEKNUM(B6)
Dynamic array formulas.
Hello Sir,

The formula return "#NAME?". I believe that I my excel is not unable to use HStack. So may I ask if there is another way to do it?
Thank you!
 
Upvote 0
Oops, could have sworn your profile showed 365. :(
 
Upvote 0
How about
Fluff.xlsm
ABCDEFGHIJKLMNOPQR
1
2Change the week number from Week 2 to Week 3 as the result will automatically change in the table below
3
4
5Week No.DateCategoriesSalesWeek No.2Week No.3
6211-Jan-23Apple50Rank.CategoriesTotal SalesRank.CategoriesTotal Sales
7211-Jan-23Mango251Apple901Banana80
8211-Jan-23Banana152Papaya752Apple75
9211-Jan-23Orange103Mango553Strawberry70
10214-Jan-23Apple404Watermelon204Orange65
11214-Jan-23Mango305Banana155Cherry60
12214-Jan-23Watermelon20
13214-Jan-23Papaya75Note:Update the Week No. to see the sale performance of any week.
14215-Jan-23Dragon fruits15Once changing the week number, then the categories and total sales will automaticallt change. And only the top 5 categories will appear on the table.
15318-Jan-23Cherry60
16318-Jan-23Apple75
17318-Jan-23Strawberry70
18318-Jan-23Grapes30
19318-Jan-23Durian20
20318-Jan-23Orange55
21318-Jan-23Banana35
22318-Jan-23Pineaple55
23319-Jan-23Orange10
24319-Jan-23Banana45
Summary
Cell Formulas
RangeFormula
H7:I11H7=LET(u,UNIQUE(FILTER(C6:C200,A6:A200=H5)),INDEX(SORT(CHOOSE({1,2},u,SUMIFS(D:D,A:A,H5,C:C,u)),2,-1),SEQUENCE(MIN(5,ROWS(u))),{1,2}))
A6:A24A6=ISOWEEKNUM(B6)
Dynamic array formulas.
 
Upvote 0
How about
Fluff.xlsm
ABCDEFGHIJKLMNOPQR
1
2Change the week number from Week 2 to Week 3 as the result will automatically change in the table below
3
4
5Week No.DateCategoriesSalesWeek No.2Week No.3
6211-Jan-23Apple50Rank.CategoriesTotal SalesRank.CategoriesTotal Sales
7211-Jan-23Mango251Apple901Banana80
8211-Jan-23Banana152Papaya752Apple75
9211-Jan-23Orange103Mango553Strawberry70
10214-Jan-23Apple404Watermelon204Orange65
11214-Jan-23Mango305Banana155Cherry60
12214-Jan-23Watermelon20
13214-Jan-23Papaya75Note:Update the Week No. to see the sale performance of any week.
14215-Jan-23Dragon fruits15Once changing the week number, then the categories and total sales will automaticallt change. And only the top 5 categories will appear on the table.
15318-Jan-23Cherry60
16318-Jan-23Apple75
17318-Jan-23Strawberry70
18318-Jan-23Grapes30
19318-Jan-23Durian20
20318-Jan-23Orange55
21318-Jan-23Banana35
22318-Jan-23Pineaple55
23319-Jan-23Orange10
24319-Jan-23Banana45
Summary
Cell Formulas
RangeFormula
H7:I11H7=LET(u,UNIQUE(FILTER(C6:C200,A6:A200=H5)),INDEX(SORT(CHOOSE({1,2},u,SUMIFS(D:D,A:A,H5,C:C,u)),2,-1),SEQUENCE(MIN(5,ROWS(u))),{1,2}))
A6:A24A6=ISOWEEKNUM(B6)
Dynamic array formulas.
Omg!!! Work perfectly...
Thank you so much Sir!!!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Hello Sir,
my sincere apologies to ask you again in this post.
May I ask if I have another column E which is "Qty", so how many make those column appear in column "J" also. I couldn't figure it out.

And is there any formula that can use in Excel 2019? like create helper column? is there any suggestion Sir?

Again, pls accept my apology.


Test16.xlsx
ABCDEFGHIJ
5Week No.DateCategoriesSalesQtyWeek No.2
6211-Jan-23Apple$ 50.0020Rank.CategoriesTotal SalesQty
7211-Jan-23Mango$ 25.00251Papaya$ 75.00
8211-Jan-23Banana$ 15.0062Mango$ 55.00
9211-Jan-23Orange$ 10.00103Apple$ 36.00
10214-Jan-23Apple$ 40.00164Orange$ 10.00
11214-Jan-23Mango$ 30.00305Banana$ 6.00
12214-Jan-23Watermelon$ 20.005
13214-Jan-23Papaya$ 75.0075
14215-Jan-23Dragon fruits$ 15.005
15318-Jan-23Cherry$ 60.0020
16318-Jan-23Apple$ 75.0030
17318-Jan-23Strawberry$ 70.0010
18318-Jan-23Grapes$ 30.0015
19318-Jan-23Durian$ 20.004
20318-Jan-23Orange$ 55.0055
21318-Jan-23Banana$ 35.007
22318-Jan-23Pineaple$ 55.0010
23319-Jan-23Orange$ 10.0010
24319-Jan-23Banana$ 45.0018
Sheet1 (2)
Cell Formulas
RangeFormula
H7:I11H7=LET(u,UNIQUE(FILTER(C6:C200,A6:A200=H5)),INDEX(SORT(CHOOSE({1,2},u,SUMIFS(E:E,A:A,H5,C:C,u)),2,-1),SEQUENCE(MIN(5,ROWS(u))),{1,2}))
A6:A24A6=ISOWEEKNUM(B6)
Dynamic array formulas.
 
Upvote 0
How about
Excel Formula:
=LET(u,UNIQUE(FILTER(C6:C200,A6:A200=H5)),INDEX(SORT(CHOOSE({1,2,3},u,SUMIFS(D:D,A:A,H5,C:C,u),SUMIFS(E:E,A:A,H5,C:C,u)),3,-1),SEQUENCE(MIN(5,ROWS(u))),{1,2,3}))
 
Upvote 1
Solution
How about
Excel Formula:
=LET(u,UNIQUE(FILTER(C6:C200,A6:A200=H5)),INDEX(SORT(CHOOSE({1,2,3},u,SUMIFS(D:D,A:A,H5,C:C,u),SUMIFS(E:E,A:A,H5,C:C,u)),3,-1),SEQUENCE(MIN(5,ROWS(u))),{1,2,3}))
Omg!!! work perfectly... And Now I also learn to add another column if needed.
Thank you! so much...
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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