Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dorre
 
Posts: n/a
Default Formula for top n

hello

I've been struggling with a formula and could use some help.
Column A shows StudentNames and column B shows Grades. The columns are
sorted by A (ascend) then B (descend). I need a formula dragged down
column C that shows the SUM of the TOP 3 grades of each student in the top
row for that student.

nb: not every student has 3 grades. For these, I'd like to sum whatever
grades they have.

The result should look like this:

A B C

1 Bill 67 167
2 Bill 50
3 Bill 50
4 Bill 46
5 Ed 85 160
6 Ed 75
7 Sue 43 43
8 Tom ...etc

drowning in formulas...
Dorre




  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default Formula for top n

dorre wrote...
I've been struggling with a formula and could use some help.
Column A shows StudentNames and column B shows Grades. The columns are
sorted by A (ascend) then B (descend). I need a formula dragged down
column C that shows the SUM of the TOP 3 grades of each student in the top
row for that student.

nb: not every student has 3 grades. For these, I'd like to sum whatever
grades they have.

The result should look like this:

A B C
1 Bill 67 167
2 Bill 50
3 Bill 50
4 Bill 46
5 Ed 85 160
6 Ed 75
7 Sue 43 43
8 Tom ...etc

....

The easiest way to do this, though it's somewhat inefficient, requires
a different formula in the top row than in all the other rows. If your
table spanned rows 1 to 100,

C1 [array formula]:
=SUM(LARGE((A$1:A$100=A1)*B$1:B$100,{1;2;3}))

C2 [array formula]:
=IF(A2<A1,SUM(LARGE((A$1:A$100=A2)*B$1:B$100,{1;2 ;3})),"")

Fill C2 down into C3:C100.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dorre
 
Posts: n/a
Default Formula for top n

Harlan - this works GREAT!!
Thanks much, Dorre

"Harlan Grove" wrote in message
oups.com...
dorre wrote...
I've been struggling with a formula and could use some help.
Column A shows StudentNames and column B shows Grades. The columns are
sorted by A (ascend) then B (descend). I need a formula dragged down
column C that shows the SUM of the TOP 3 grades of each student in the top
row for that student.

nb: not every student has 3 grades. For these, I'd like to sum whatever
grades they have.

The result should look like this:

A B C
1 Bill 67 167
2 Bill 50
3 Bill 50
4 Bill 46
5 Ed 85 160
6 Ed 75
7 Sue 43 43
8 Tom ...etc

...

The easiest way to do this, though it's somewhat inefficient, requires
a different formula in the top row than in all the other rows. If your
table spanned rows 1 to 100,

C1 [array formula]:
=SUM(LARGE((A$1:A$100=A1)*B$1:B$100,{1;2;3}))

C2 [array formula]:
=IF(A2<A1,SUM(LARGE((A$1:A$100=A2)*B$1:B$100,{1;2 ;3})),"")

Fill C2 down into C3:C100.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 Nesting questions Starchaser Excel Worksheet Functions 7 January 20th 06 06:53 PM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM
Match / Vlookup within an Array formula Hari Prasadh Excel Discussion (Misc queries) 3 February 3rd 05 04:37 PM


All times are GMT +1. The time now is 04:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"