Top ten list using lookup functions - offset?

michellebno

New Member
Joined
Jun 17, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi, I am trying to list the top 10 accounts for my sales people. There may be more or less than 10 accounts for each sale person. I was going to use vlookup for the first one and then offset, but vlookup is a range and doesn't work that way. I just learned about IndexMatch, but it's finding the last instance of the sales person's name, not the first. I've attached an example file. I'm wanting find Bob Smith, return Kroger and it's sales, then use OFFSET to show me the next 4 underneath (or any other solution to build this). But instead of giving me Kroger, it's giving me the last one for Bob Smith, Chevron. Suggestions?
Excel example.png
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi Michellebno,

This should work for you

Michellebno.xlsx
ABCDEFG
1Bob SmithSalespersonCustomerSales
2RankTop CustomersCases SoldBob SmithKroger164
31Kroger164Bob SmithCostco77
42Costco77Bob SmithCust366
53Cust366Bob SmithCust455
64Cust455Bob SmithCust555
75Cust555Bob SmithCust633
8Bob SmithCust722
9Lucy BrownBob SmithCust811
10RankTop CustomersCases SoldSusan ThomasACME200
111Costco220Susan ThomasBodgit22
122Cust166Lucy BrownCostco220
133  Lucy BrownCust166
144  
155  
16
Sheet1
Cell Formulas
RangeFormula
B11:C15,B3:C7B3=IFERROR(INDEX(F$2:F$9999,AGGREGATE(15,6,ROW($F$2:$F$9999)-ROW($F$1)/(($E$2:$E$9999=INDEX($A$1:$A$9999,ROW()-$A3-1))),$A3)),"")
 
Upvote 0
...and here's another version using OFFSET

Michellebno.xlsx
ABCDEFG
1Bob SmithSalespersonCustomerSales
2RankTop CustomersCases SoldBob SmithKroger164
31Kroger164Bob SmithCostco77
42Costco77Bob SmithCust366
53Cust366Bob SmithCust455
64Cust455Bob SmithCust555
75Cust555Bob SmithCust633
8Bob SmithCust722
9Lucy BrownBob SmithCust811
10RankTop CustomersCases SoldSusan ThomasACME200
111Costco220Susan ThomasBodgit22
122Cust166Lucy BrownCostco220
133  Lucy BrownCust166
144  
155  
Sheet1 (2)
Cell Formulas
RangeFormula
B11:C15,B3:C7B3=IF(COUNTIF($E$2:$E$9999,INDEX($A$1:$A$9999,ROW()-$A3-1))>=$A3,OFFSET(F$1,MATCH(INDEX($A$1:$A$9999,ROW()-$A3-1),$E$2:$E$9999,0)-1+$A3,0),"")
 
Upvote 0
Solution
Hi & welcome to MrExcel.
Another option
+Fluff 1.xlsm
ABCDEFG
1Bob SmithSalespersonCustomerSales
2RankTop CustomersCases SoldBob SmithKroger164
31Kroger164Bob SmithCostco77
42Costco77Bob SmithCust366
53Cust366Bob SmithCust455
64Cust455Bob SmithCust555
75Cust555Bob SmithCust633
8Bob SmithCust722
9Lucy BrownBob SmithCust811
10RankTop CustomersCases SoldSusan ThomasACME200
111Costco220Susan ThomasBodgit22
122Cust166Lucy BrownCostco220
133Lucy BrownCust166
144
155
16
Lists
Cell Formulas
RangeFormula
B3:C7B3=LET(Fltr,FILTER(F2:G20,E2:E20=A1),INDEX(Fltr,SEQUENCE(MIN(ROWS(Fltr),5)),{1,2}))
B11:C12B11=LET(Fltr,FILTER(F2:G20,E2:E20=A9),INDEX(Fltr,SEQUENCE(MIN(ROWS(Fltr),5)),{1,2}))
Dynamic array formulas.
 
Upvote 0
.. another possible variation to consider.

21 05 03.xlsm
ABCDEFG
1Bob SmithSalespersonCustomerSales
2RankTop CustomersCases SoldBob SmithKroger164
31Kroger164Bob SmithCostco77
42Costco77Bob SmithCust366
53Cust366Bob SmithCust455
64Cust455Bob SmithCust555
75Cust555Bob SmithCust633
8Bob SmithCust722
9Lucy BrownBob SmithCust811
10RankTop CustomersCases SoldSusan ThomasACME200
111Costco220Susan ThomasBodgit22
122Cust166Lucy BrownCostco220
13Lucy BrownCust166
14
Top N
Cell Formulas
RangeFormula
A3:A7,A11:A12A3=SEQUENCE(MIN(5,COUNTIF(E$2:E$13,A1)))
B3:C7B3=INDEX(FILTER(F2:G13,E2:E13=A1),A3#,{1,2})
B11:C12B11=INDEX(FILTER(F2:G13,E2:E13=A9),A11#,{1,2})
Dynamic array formulas.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,780
Messages
6,121,527
Members
449,037
Latest member
tmmotairi

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