Returning top 3 list with duplicates using INDEX, MATCH, IF, SMALL & TEXTJOIN

Dlloyd15

New Member
Joined
Feb 20, 2020
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Firstly I'd just like to say I'm fairly new at using extensive functions in Excel, so if I've missed anything or am doing this the completely wrong way then apologies, still trying to get my head round everything.

So my problem:
I have a table with first name, last name, office, and (car) CO2 emissions and am trying to get the name of the employees with the 3 best (lowest) CO2 emissions per office, in this case = GS. But am trying to keep everything tidy so have one big formula in a cell doing all the functions simultaneously. So far I have been able to do this but have hit a block because the 3rd best (lowest) employee is joint 3rd with 108 g/km and as a result the cell is only showing one name rather than the two.

Does anyone know what i need to do to fix this, or if it is possible? Formula and tables below. Hopefully this all makes sense but happy to answer any questions if not/it helps.

Thanks in advance!

(P.S. all names have been changed)

(Array) Formula:

{=(TEXTJOIN(",",TRUE,INDEX($B$11:$E$77,MATCH(1,($E$11:$E$77=SMALL(IF($D$11:$D$77="GS",$E$11:$E$77),3))*($D$11:$D$77="GS"),0),2)))}

This returns 'Ellis' but I need it to return 'Ellis,Parker' as both are the 3rd best CO2 emissions in the 'GS' office.

Table:
First NameLast NameOfficeCo2 Emission
OliverCaseyIN157
AidaCrawfordGS214
WilliamEllisGS108
NatalieArmstrongMD119
RosieBakerMD89
StellaBrooksIN105
OscarParkerGS108
NatalieMorrisIN115
AlenGibsonGS105
BriannaEvansMD111
AmberJonesNT133
MirandaArmstrongNT104
BrookeMasonGS133
MyraHillGS165
RyanHillMD117
RafaelGrantMD117
LuciaHillIN256
JuliaMasonGS128
EdwardBaileyWW169
AidenMurrayWW119
LilyReedLE112
KellanGibsonIN0
DarylSullivanIN138
DexterScottGS99
MartinRobertsMD127
MichelleEllisIN209
JustinWrightIN91
BradAllenGS120
RichardEllisIN134
ConnieHarperIN106
ValeriaBrownIN106
BrionyPerryGS124
CarlMorrisIN120
CarlosAdamsIN153
AprilClarkGS113
BrookeAlexanderIN129
BriannaColeIN146
PenelopeChapmanIN294
KevinDavisWW103
PaigeMitchellGS112
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Here it is.
Formulas.xlsx
JK
7Co2 EmissionRank
801
901
1001
1101
1201
13892
14993
151044
161055
171055
181055
Sheet3
Cell Formulas
RangeFormula
K8:K18K8=SUMPRODUCT((J8>=$J$8:$J$18)/COUNTIF($J$8:$J$18,$J$8:$J$18))
 
Upvote 0
Another option for that..

Dlloyd15 2020-02-22 1.xlsm
JK
7Co2 EmissionRank
801
901
1001
1101
1201
13892
14993
151044
161055
171055
181055
Sheet1
Cell Formulas
RangeFormula
K8:K18K8=N(K7)+(J8<>J7)
 
Upvote 0
Thanks. That formula is much easier to use.
Cheers. :)

Also, since column J is the result of a 'spill' from a dynamic array formula, that list could be longer or shorter, so this, copied down as far as you might ever need might be better.

=IF(J8="","",N(K7)+(J8<>J7))
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,513
Members
448,967
Latest member
screechyboy79

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