Problems with duplicates nth largest formula

cjmueller08

New Member
Joined
Aug 28, 2009
Messages
17
Hello Gurus,
I have a customer database segmented and I'm using the large function to display top customers. I'm getting the top results fine but unfortunately there are duplicates and I'm having issues displaying the customer name next to the $ amounts. For the duplicates it's displaying the same name as the first value.

IAN TOWELL$315
CITY OF MADISON$304
AV CONSTRUCTION$295
AV CONSTRUCTION$295
AV CONSTRUCTION$295
RESIDENTIAL DESIGN$288

Formula for finding the top dollar amounts:
=LARGE(Segment!$Q$21:$Q$9045,ROW(S51)-ROW(S$12))

Formula for finding the customer name that corresponds to dollar amount:
=INDEX(Segment!$D$21:$D$9045,SMALL(IF(Segment!$Q$21:$Q$9045=S51,ROW(Segment!$Q$21:$Q$9045)-ROW(Segment!$Q$20)),COUNTIF($D$13:D51,D51)))

Thanks in advance for your help!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
What cells are those formulae in?
 
Upvote 0
IAN TOWELL R51$315 S51
CITY OF MADISON R52$304 S52
AV CONSTRUCTION R53$295 S53
AV CONSTRUCTION R54$295 S54
AV CONSTRUCTION R55$295 S55
RESIDENTIAL DESIGN R56$288 S56

Formula for finding the top dollar amounts: Formula S51
=LARGE(Segment!$Q$21:$Q$9045,ROW(S51)-ROW(S$12))

Formula for finding the customer name that corresponds to dollar amount: Formula for R51
=INDEX(Segment!$D$21:$D$9045,SMALL(IF(Segment!$Q$21:$Q$9045=S51,ROW(Segment!$Q$21:$Q$9045)-ROW(Segment!$Q$20)),COUNTIF($D$13:D51,D51)))
 
Upvote 0
Are those the first cells with those formulae? or do they start in S13 & R13?
 
Upvote 0
One way to do this would be to use LARGE on an array of value+row

=10000*MOD(LARGE(Segment!$D$21:$D$9045+ROW(Segment!$D$21:$D$9045)/10000,2), 1)

is the row number of the 2'nd largest value in your data set.

The name associated with that value would be

=INDEX(Segment!$C:$C, 10000*MOD(LARGE(Segment!$D$21:$D$9045+ROW(Segment!$D$21:$D$9045)/10000,2), 1), 1)
 
Upvote 0
Sorry, I'll just post a picture of the spreadsheet. Yellow highlighted area is the area I was talking about:
 

Attachments

  • Screen Shot 2021-04-02 at 8.17.22 AM.png
    Screen Shot 2021-04-02 at 8.17.22 AM.png
    224.8 KB · Views: 6
Upvote 0
Try
Excel Formula:
=INDEX(Segment!$D$21:$D$9045,SMALL(IF(Segment!$Q$21:$Q$9045=S51,ROW(Segment!$Q$21:$Q$9045)-ROW(Segment!$Q$20)),COUNTIF($S$13:S51,S51)))
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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