Select Top 5 based on multiple criteria

nikhil0311

Board Regular
Joined
May 3, 2013
Messages
197
Office Version
  1. 2013
Platform
  1. Windows
ABCDEFGHI
1IDStageCountry$ Revenue
21BidIndia$7
31BidIndia$5Criteria
42MandateChina$4StageBid
54BidIndia$6CountryIndia
65OppHK$2
776BidIndia$4Top 5ID$ Revenue
889MandateChina$51112
954oppAus/NZ$623310
1033OppAus/NZ$73458
1145BidIndia$8446
1243OppMalaysia$95764
1333BidIndia$10

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2




Hello Friends
I have a data from column A1:D13
based on column A i.e. ID AND column B i.e. stage AND column C i.e. Country
I want to sum Column D i.e. Revenue.

For instance if Id is 1 and Stage is Bid & Country is India then the revenue should be $12.
Now in Column G4:H5 I have criteria and based on this criteria i want Top 5 Revenues & ID's based on Revenue (largest to smallest)in Column H8:I13.
Let me know if this is possible or not?

Thanks in advance!!
 
Last edited:

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Book1
ABCDEFGH
1IDStageCountry$ RevenueCriteria
21BidIndia7StageBid
31BidIndia5CountryIndia
42MandateChina4Top5
54BidIndia6Top 5 Value4
65OppHK2Top 5 Adjusted5
776BidIndia4
889MandateChina5ID$ Revenue
954oppAus/NZ6112
1033OppAus/NZ73310
1145BidIndia8458
1243OppMalaysia946
1333BidIndia10764
14
Sheet1


1. H4 houses the desired Top N value.

2. In H5 control+shift+enter, not just enter:

=LARGE(SUMIFS(D2:D13,B2:B13,H2,C2:C13,H3,A2:A13,IF(FREQUENCY(IF(1-(A2:A13=""),IF(B2:B13=H2,IF(C2:C13=H3,MATCH(A2:A13,A2:A13,0)))),ROW(A2:A13)-ROW(A2)+1),A2:A13)),MIN(H4,SUM(IF(FREQUENCY(IF(1-(A2:A13=""),IF(B2:B13=H2,IF(C2:C13=H3,MATCH(A2:A13,A2:A13,0)))),ROW(A2:A13)-ROW(A2)+1),1))))

This cell calculates the Nth conditional sum...

3. In H6 control+shift+enter, not just enter:

=IFERROR(SUM(IF(SUMIFS(D2:D13,B2:B13,H2,C2:C13,H3,A2:A13,IF(FREQUENCY(IF(1-(A2:A13=""),IF(B2:B13=H2,IF(C2:C13=H3,MATCH(A2:A13,A2:A13,0)))),ROW(A2:A13)-ROW(A2)+1),A2:A13))>=H5,1)),0)

This cell re-calculates the Top N value based on the available data and the ties of the Nth value if any.

4. In G9 control+shift+enter, not just enter, and copy down in order to list the Top ID's:

=IF($H9="","",INDEX($A$2:$A$13,SMALL(IF(SUMIFS($D$2:$D$13,$B$2:$B$13,$H$2,$C$2:$C$13,$H$3,$A$2:$A$13,IF(FREQUENCY(IF(1-($A$2:$A$13=""),IF($B$2:$B$13=$H$2,IF($C$2:$C$13=$H$3,MATCH($A$2:$A$13,$A$2:$A$13,0)))),ROW($A$2:$A$13)-ROW($A$2)+1),$A$2:$A$13))=$H9,ROW($A$2:$A$13)-ROW($A$2)+1),COUNTIFS($H$9:H9,H9))))

5. In H9 control+shift+enter, not just enter, and copy down in order to list the Top revenues:

=IF(ROWS($H$9:H9)>$H$6,"",LARGE(SUMIFS($D$2:$D$13,$B$2:$B$13,$H$2,$C$2:$C$13,$H$3,$A$2:$A$13,IF(FREQUENCY(IF(1-($A$2:$A$13=""),IF($B$2:$B$13=$H$2,IF($C$2:$C$13=$H$3,MATCH($A$2:$A$13,$A$2:$A$13,0)))),ROW($A$2:$A$13)-ROW($A$2)+1),$A$2:$A$13)),ROWS($H$9:H9)))
 
Upvote 0

Forum statistics

Threads
1,216,176
Messages
6,129,318
Members
449,501
Latest member
Amriddin

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