XLOOKUP With Duplicates

excelbytes

Active Member
Joined
Dec 11, 2014
Messages
251
Office Version
  1. 365
Platform
  1. Windows
See the attached image. I'm using this formula to pull in the Set numbers, 1st largest, 2nd largest, etc., but the issue is when there are duplicate values. How do I get #4 to return Set 9 rather than Set 1 again?

Thanks,
Top List.png
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try using the SORT or SORTBY functions instead of XLOOKUP. I don't have a device with excel installed to hand in order to provide the correct syntax for the formula but one of those will do what you need, it may need some extra functions to limit the number of results returned if you only want top 6 rather than all records in the list.
 
Upvote 0
Maybe something like this:
Book1
ABCDE
1GameByCol1
2Set112Return Top:6
3Set21
4set4410#1Set7
5Set42#2Set5
6Set522#3Set9
7set103#4Set1
8Set750#5set44
9Set83#6Set12
10Set922
11set225
12Set116
13Set127
Sheet3
Cell Formulas
RangeFormula
E4:E9E4=FILTER(SORT(FILTER(A2:B13,B2:B13>=LARGE(B2:B13,$E$2)),2,-1),{1,0})
Dynamic array formulas.
 
Upvote 0
Following up on my earlier suggestion to try SORTBY, see if this works (untested).
Excel Formula:
=INDEX(SORTBY($A$2$:A$24,$B$2$:B$24,-1),SEQUENCE(6))
We can not see from the screen capture if B12:B23 are empty or if they contain formula blanks. In many cases this simple difference can affect the results of dependent formulas.
 
Upvote 0
Borrowing the mini sheet kindly provided by @AhoyNC in order to show my suggested formula working (after correcting the typos). I've also made a slight change to allow more flexibility if more or less than 6 results are needed.

Book1
ABCDE
1GameByCol1
2Set112Return Top:6
3Set21
4set44101Set7
5Set422Set5
6Set5223Set9
7set1034Set1
8Set7505set44
9Set836Set12
10Set922
11set225
12Set116
13Set127
Sheet1
Cell Formulas
RangeFormula
D4:D9D4=SEQUENCE(E2)
E4:E9E4=INDEX(SORTBY($A$2:$A$24,$B$2:$B$24,-1),D4#)
Dynamic array formulas.
 
Upvote 0
Solution
I like the formula =INDEX(SORTBY($A$2:A$24,$B$2:B$24,-1),SEQUENCE(6)) from jasonb75. I also came up with a more cumbersome one =SORTBY(FILTER(A2:A24,B2:B24>=LARGE(B2:B24,6)),FILTER(B2:B24,B2:B24>=LARGE(B2:B24,6)),-1)

Thanks for your help!
 
Upvote 0
Another option
Fluff.xlsm
ABCDE
1GameByCol1
2Set112Return Top:6
3Set21
4set4410Set7
5Set42Set5
6Set522Set9
7set103Set1
8Set750set44
9Set83Set12
10Set922
11set225
12Set116
13Set127
Data
Cell Formulas
RangeFormula
E4:E9E4=INDEX(SORT($A$2:$B$24,2,-1),SEQUENCE(E2))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,996
Messages
6,122,636
Members
449,092
Latest member
bsb1122

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