Top 10 Values- Skip Duplicate

emerdmann

New Member
Joined
Feb 1, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I am measuring "population" for states/cities. I would like to get a list of top 3 states/cities in critical status based on population. The dataset I am using has metrics for years 1910-2017. Short example with made up data:

ABCDE
1StateCityYearStatusPopulation
2PennsylvaniaPhiladelphia1910Critical554,000
3PennsylvaniaPhiladelphia1911Critical650,987
4PennsylvaniaPhiladelphia1912Critical982,545
5DelawareWilmington1910Critical450,240
6New JerseyOcean City1912Critical245,568
7New JerseyOcean City1913Safe982,245
8TexasAustin1910Semi-Critical654,244

To do this, I used the following formula:
Excel Formula:
=LARGE(IF(D2:D8=H2,E2:E8,""),ROW(A1:A3))
(Cell H3 to the side of this table has the text "critical")

When it returned my data I got the following result:
982,545
650,987
554,000
When I matched the population data to the state/city I just had a list of Pennsylvania-Philadelphia. What I really was looking for is:
982,545 (Pennsylvania-Philadelphia)
450,240 (Delaware, Wilmington)
245,568 (New Jersey, Ocean City)

I understand that Pennsylvania-Philadelphia has the 3 largest population sizes, but I only want it listed once and I want the highest value. I want the formula to skip duplicates of Pennsylvania-Philadelphia again. I've researched using the UNIQUE function in my formula, but I only know how to apply that to population size and not unique listing of State/City.

Any help?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Do you have functions such as TAKE & HSTACK?
If so, how about
Fluff.xlsm
ABCDEFGHIJK
1StateCityYearStatusPopulation
2PennsylvaniaPhiladelphia1910Critical554,000CriticalPennsylvaniaPhiladelphia982545
3PennsylvaniaPhiladelphia1911Critical650,987DelawareWilmington450240
4PennsylvaniaPhiladelphia1912Critical982,545New JerseyOcean City245568
5DelawareWilmington1910Critical450,240
6New JerseyOcean City1912Critical245,568
7New JerseyOcean City1913Safe982,245
8TexasAustin1910Semi-Critical654,244
9
Report
Cell Formulas
RangeFormula
I2:K4I2=LET(u,UNIQUE(FILTER(A2:B1000,(A2:A1000<>"")*(D2:D1000=H2))),TAKE(SORT(HSTACK(u,MAXIFS(E:E,A:A,INDEX(u,,1),D:D,H2)),3,-1),10))
Dynamic array formulas.
 
Upvote 0
Do you have functions such as TAKE & HSTACK?
If so, how about
Fluff.xlsm
ABCDEFGHIJK
1StateCityYearStatusPopulation
2PennsylvaniaPhiladelphia1910Critical554,000CriticalPennsylvaniaPhiladelphia982545
3PennsylvaniaPhiladelphia1911Critical650,987DelawareWilmington450240
4PennsylvaniaPhiladelphia1912Critical982,545New JerseyOcean City245568
5DelawareWilmington1910Critical450,240
6New JerseyOcean City1912Critical245,568
7New JerseyOcean City1913Safe982,245
8TexasAustin1910Semi-Critical654,244
9
Report
Cell Formulas
RangeFormula
I2:K4I2=LET(u,UNIQUE(FILTER(A2:B1000,(A2:A1000<>"")*(D2:D1000=H2))),TAKE(SORT(HSTACK(u,MAXIFS(E:E,A:A,INDEX(u,,1),D:D,H2)),3,-1),10))
Dynamic array formulas.
Hey,

Thanks for the help here. Unfortunately, I do not think my version of Excel has that capability. I just tried it out and I do not think it recognized the "u" or "HSTACK" functions. I appreciate the response, though!
 
Upvote 0
Do you have the LET function?
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,575
Members
449,039
Latest member
Arbind kumar

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