Large formula by criteria

Matt_Chelmsford

Board Regular
Joined
Jan 31, 2009
Messages
160
Hi,

I have a data set of about 500 lines

In Column B I have contract codes
In Column C I have account numbers
In Column T I have total costs

For each Contract, I need to extract the 10 largest accounts value and return the account number to another sheet.

If it was just one contract and no criteria, then this formula would work me, but the criteria has stumped me!

=OFFSET(T1,match(Large(T:T,1),T:T,0),-17,1,1)

Any help given will be gratefully appreciated

Matthew
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi Steve, Others will be consuming the data and it will change. It is the easiest solution without doubt, but does not really fit in to what I am trying to achieve here!
 
Upvote 0
I presume then that the contract codes can be repeated within the data?
 
Upvote 0

Book1
BCD
1contactacc #tcosts
2c100ACC-154
3c101ACC-329
4c102ACC-452
5c103ACC-764
6c104ACC-250
7c105ACC-0959
8c106ACC-1254
9c107ACC-2052
10c108ACC-1130
11c109ACC-1749
12c110ACC-3550
13
Sheet1



Book1
AB
1top
25
36
4largest accountsaccount #
564ACC-7
659ACC-09
754ACC-1
854ACC-12
952ACC-4
1052ACC-20
11
Sheet2


Change A2 of Sheet2 to 10 for your data.

In A3 of Sheet2 control+shift+enter, not just enter:

=COUNTIFS(Sheet1!D2:D12,">="&LARGE(Sheet1!D2:D12,MIN(A2,COUNT(Sheet1!D2:D12))))

In A5 of Sheet2 control+shift+enter, not just enter, and copy down:

=IF(ROWS($A$5:A5)>$A$3,"",LARGE(Sheet1!$D$2:$D$12,ROWS($A$5:A5)))

In B5 of Sheet2 control+shift+enter, not just enter, and copy down:

=IF($A5="","",INDEX(Sheet1!$C$2:$C$12,SMALL(IF(Sheet1!$D$2:$D$12=$A5,ROW(Sheet1!$C$2:$C$12)-ROW(Sheet1!$C$2)+1),COUNTIFS($A$5:A5,A5))))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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