INDEX/MATCH but show duplicates (first one, then the other)

RonOliver

Board Regular
Joined
Aug 30, 2022
Messages
99
Office Version
  1. 365
Platform
  1. Windows
Hi everybody!

I have a list of people in column A and their marks in column B. I'm doing a LARGE function to find the five highest marks and then I'm also using an INDEX/MATCH to find the name that is in the adjacent cell (so that I have the name of the person that got the high mark). My problem comes when the INDEX/MATCH (and LARGE) functions find duplicate marks. For example, if both Sarah and Suzanne got a 8.3 and Sarah's name comes up first in the list, I'm going to get Sarah's name twice. Is there a formula I can use to prevent this from happening?

My formula is as follows:

Excel Formula:
=INDEX($A$1:$A$35,MATCH(LARGE($B$1:$B$35,2),$B$1:$B$35,0))
.

When I drag to fill (and change the LARGE function's "k" number), I get Sarah's name twice, instead of getting Sarah first and Suzanne right below it (after I drag to fill). I guess this is very easy, but I have no idea how to fix this without using an overly complicated formula.

Thanks for your suggestions!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I used a different approach. Loaded data to power query, Sorted Descending. Added a column of sequential numbers starting with 1. Filtered the sequential numbers for those below 6. Here is the code and sample data for you to review.
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Sorted Rows" = Table.Sort(Source,{{"Mark", Order.Descending}}),
    #"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 1, 1, Int64.Type),
    #"Filtered Rows" = Table.SelectRows(#"Added Index", each [Index] < 6),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Index"})
in
    #"Removed Columns"

MOCK_DATA.xlsx
ABCDE
1first_nameMarkfirst_nameMark
2Garrek53Gunter99
3Gunter99Teri99
4Katleen84Monika97
5Page72Broddy96
6Orville58Haskell95
7Mari67
8Jeremie29
9Tadeo67
10Katy87
11Walden82
12Rebekkah31
13Agretha52
14Amber72
15Teri99
16Monika97
17Haskell95
18Seana80
19Josephina41
20Ginelle36
21Ted89
22Alvina57
23Caresse30
24Julian48
25Vanny34
26Lamond78
27Andree90
28Deanna90
29Bendix51
30Edlin45
31Siouxie90
32Donella55
33Broddy96
34Clarissa73
35Ali72
36Jania42
data
 
Upvote 0
I used a different approach. Loaded data to power query, Sorted Descending. Added a column of sequential numbers starting with 1. Filtered the sequential numbers for those below 6. Here is the code and sample data for you to review.
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Sorted Rows" = Table.Sort(Source,{{"Mark", Order.Descending}}),
    #"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 1, 1, Int64.Type),
    #"Filtered Rows" = Table.SelectRows(#"Added Index", each [Index] < 6),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Index"})
in
    #"Removed Columns"

MOCK_DATA.xlsx
ABCDE
1first_nameMarkfirst_nameMark
2Garrek53Gunter99
3Gunter99Teri99
4Katleen84Monika97
5Page72Broddy96
6Orville58Haskell95
7Mari67
8Jeremie29
9Tadeo67
10Katy87
11Walden82
12Rebekkah31
13Agretha52
14Amber72
15Teri99
16Monika97
17Haskell95
18Seana80
19Josephina41
20Ginelle36
21Ted89
22Alvina57
23Caresse30
24Julian48
25Vanny34
26Lamond78
27Andree90
28Deanna90
29Bendix51
30Edlin45
31Siouxie90
32Donella55
33Broddy96
34Clarissa73
35Ali72
36Jania42
data
I like your approach. I'd like to avoid using anything outside of formulas, though. But you gave me a wonderful idea. I can get a helper column and sort the list by mark, then take the first five names and marks from that list. If only there was a way to do this using no helper columns (maybe with a LET function). I'll give it some thought and see if I can come up with it. Thanks so much for your input!
 
Upvote 0
Try:
Book3
ABCDE
1first_nameMarkfirst_nameMark
2Garrek53Gunter99
3Gunter99Teri99
4Katleen84Monika97
5Page72Broddy96
6Orville58Haskell95
7Mari67
8Jeremie29
9Tadeo67
10Katy87
11Walden82
12Rebekkah31
13Agretha52
14Amber72
15Teri99
16Monika97
17Haskell95
18Seana80
19Josephina41
20Ginelle36
21Ted89
22Alvina57
23Caresse30
24Julian48
25Vanny34
26Lamond78
27Andree90
28Deanna90
29Bendix51
30Edlin45
31Siouxie90
32Donella55
33Broddy96
34Clarissa73
35Ali72
36Jania42
Sheet1
Cell Formulas
RangeFormula
D2:D6D2=INDEX($A$2:$A$36,AGGREGATE(15,6,(ROW($A$2:$A$36)-ROW($A$2)+1)/($B$2:$B$36=E2),COUNTIF($E$2:E2,E2)))
 
Upvote 0
Try:
Book3
ABCDE
1first_nameMarkfirst_nameMark
2Garrek53Gunter99
3Gunter99Teri99
4Katleen84Monika97
5Page72Broddy96
6Orville58Haskell95
7Mari67
8Jeremie29
9Tadeo67
10Katy87
11Walden82
12Rebekkah31
13Agretha52
14Amber72
15Teri99
16Monika97
17Haskell95
18Seana80
19Josephina41
20Ginelle36
21Ted89
22Alvina57
23Caresse30
24Julian48
25Vanny34
26Lamond78
27Andree90
28Deanna90
29Bendix51
30Edlin45
31Siouxie90
32Donella55
33Broddy96
34Clarissa73
35Ali72
36Jania42
Sheet1
Cell Formulas
RangeFormula
D2:D6D2=INDEX($A$2:$A$36,AGGREGATE(15,6,(ROW($A$2:$A$36)-ROW($A$2)+1)/($B$2:$B$36=E2),COUNTIF($E$2:E2,E2)))
Thank you so very much. I didn't know the AGGREGATE function, so I definitely learned something today!
 
Upvote 0
Another option
Fluff.xlsm
ABCDE
1first_nameMarkfirst_nameMark
2Garrek53Gunter99
3Gunter99Teri99
4Katleen84Monika97
5Page72Broddy96
6Orville58Haskell95
7Mari67
8Jeremie29
9Tadeo67
10Katy87
11Walden82
12Rebekkah31
13Agretha52
14Amber72
15Teri99
16Monika97
17Haskell95
18Seana80
19Josephina41
20Ginelle36
21Ted89
22Alvina57
23Caresse30
24Julian48
25Vanny34
26Lamond78
27Andree90
28Deanna90
29Bendix51
30Edlin45
31Siouxie90
32Donella55
33Broddy96
34Clarissa73
35Ali72
36Jania42
Main
Cell Formulas
RangeFormula
D2:E6D2=TAKE(SORT(A2:B36,2,-1),5)
Dynamic array formulas.
 
Upvote 0
Solution
Another option
Fluff.xlsm
ABCDE
1first_nameMarkfirst_nameMark
2Garrek53Gunter99
3Gunter99Teri99
4Katleen84Monika97
5Page72Broddy96
6Orville58Haskell95
7Mari67
8Jeremie29
9Tadeo67
10Katy87
11Walden82
12Rebekkah31
13Agretha52
14Amber72
15Teri99
16Monika97
17Haskell95
18Seana80
19Josephina41
20Ginelle36
21Ted89
22Alvina57
23Caresse30
24Julian48
25Vanny34
26Lamond78
27Andree90
28Deanna90
29Bendix51
30Edlin45
31Siouxie90
32Donella55
33Broddy96
34Clarissa73
35Ali72
36Jania42
Main
Cell Formulas
RangeFormula
D2:E6D2=TAKE(SORT(A2:B36,2,-1),5)
Dynamic array formulas.
I actually think I like this even better. Much simpler and neat. Thanks!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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