Lookup with duplicates & conditions

Graemea

Board Regular
Joined
Oct 30, 2015
Messages
119
Office Version
  1. 365
Platform
  1. Windows
Hi,


I have sample data in columns A and B, with product names in column A and sales per product in column B.


The last row in the range has the world "Total" in column A and the total of the sales values above in column B.


In E2:F4 I would like to create formulae to extract from A:B the Sales and associated Product names for the three largest sales values.


Two complications are that there may be more than one product name associated with a sales value (e.g. product AAA and product CCC with 50) and I don't want the value associated with "Total" to be considered among the largest values.


I would rather use formulae than any sort of filtering.


Can someone please suggest the formulae to use?


Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi,

Is that what your trying to achieve?
You just need the formulas in E2 and F2 then drag down.

ABCDEF
1ProductSalesProductSales
2AAA50AAA50
3BBB10CCC50
4CCC50DDD30
5DDD30GGG30
6EEE10FFF20
7FFF20KKK20
8GGG30HHH15
9HHH15BBB10
10III5EEE10
11JJJ0III5
12KKK20JJJ0
13Total240

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

Worksheet Formulas
CellFormula
E2=IF($F2="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E1,$A$2:$A$12)+($F2>$B$2:$B$12),),0)))
F2=LARGE($B$2:$B$12,ROWS(E$2:E2))
E3=IF($F3="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E2,$A$2:$A$12)+($F3>$B$2:$B$12),),0)))
F3=LARGE($B$2:$B$12,ROWS(E$2:E3))
E4=IF($F4="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E3,$A$2:$A$12)+($F4>$B$2:$B$12),),0)))
F4=LARGE($B$2:$B$12,ROWS(E$2:E4))
E5=IF($F5="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E4,$A$2:$A$12)+($F5>$B$2:$B$12),),0)))
F5=LARGE($B$2:$B$12,ROWS(E$2:E5))
E6=IF($F6="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E5,$A$2:$A$12)+($F6>$B$2:$B$12),),0)))
F6=LARGE($B$2:$B$12,ROWS(E$2:E6))
E7=IF($F7="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E6,$A$2:$A$12)+($F7>$B$2:$B$12),),0)))
F7=LARGE($B$2:$B$12,ROWS(E$2:E7))
E8=IF($F8="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E7,$A$2:$A$12)+($F8>$B$2:$B$12),),0)))
F8=LARGE($B$2:$B$12,ROWS(E$2:E8))
E9=IF($F9="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E8,$A$2:$A$12)+($F9>$B$2:$B$12),),0)))
F9=LARGE($B$2:$B$12,ROWS(E$2:E9))
E10=IF($F10="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E9,$A$2:$A$12)+($F10>$B$2:$B$12),),0)))
F10=LARGE($B$2:$B$12,ROWS(E$2:E10))
E11=IF($F11="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E10,$A$2:$A$12)+($F11>$B$2:$B$12),),0)))
F11=LARGE($B$2:$B$12,ROWS(E$2:E11))
E12=IF($F12="","",INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF(E$1:E11,$A$2:$A$12)+($F12>$B$2:$B$12),),0)))
F12=LARGE($B$2:$B$12,ROWS(E$2:E12))
B13=SUM(B2:B12)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,637
Messages
6,125,965
Members
449,276
Latest member
surendra75

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