Macro needed

Avdberg

New Member
Joined
May 11, 2017
Messages
13
Hi,
Would you please be so kind and assist me with a macro to extract specific data within a spreadsheet. The specs are. I have a list of students 30+ who rights exams every week and I want to extract the top 3 marks and names each week. Should there be more than 3 student with the same mark in the top 3 then I want to see all those students even if it's more that 3. Below is a example of how I did it manually.

Nameweek 1 week 2 week 3
Anna21 25 23
Carl18 20 19
Jill16 21 29
John27 25 23
Liz19 22 21
Peter29 25 27
Sandra25 25 22
Susan20 23 19
Tim24 25 20
Peter29 Anna25 Jill29
John27 John25 Peter27
Sandra25 Peter25 Anna23
Sandra25 John23

Thank you
Tim25

<tbody>
</tbody><colgroup><col><col><col><col><col><col><col><col><col></colgroup>
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
a macro to extract specific data within a spreadsheet.

Hi, I wonder if you can be tempted with a formula based option.

The formulas in F2:G2 are copied down as far as might be required, the whole table in F:G is copied to I:J and L:M and only the week number needs changing to affect the updated results.


Excel 2013/2016
ABCDEFGHIJKLM
1Nameweek 1week 2week 3Week 13Week 25Week 34
2Anna212523Peter29Anna25Jill29
3Carl182019John27John25Peter27
4Jill162129Sandra25Peter25Anna23
5John272523Sandra25John23
6Liz192221Tim25
7Peter292527
8Sandra252522
9Susan202319
10Tim242520
Sheet1
Cell Formulas
RangeFormula
G1=COUNTIFS(INDEX($B$2:$D$50,0,MATCH(F1,$B$1:$D$1,0)),">="&LARGE(INDEX($B$2:$D$50,0,MATCH(F1,$B$1:$D$1,0)),3))
G2=IF(ROWS(G$2:G2)>G$1,"",LARGE(INDEX($B$2:$D$50,0,MATCH(F$1,$B$1:$D$1,0)),ROWS(G$2:G2)))
F2=IF(G2="","",INDEX($A$2:$A$50,AGGREGATE(15,6,(ROW($A$2:$A$50)-ROW($A$2)+1)/(INDEX($B$2:$D$50,0,MATCH(F$1,$B$1:$D$1,0))=G2),COUNTIFS(G$2:G2,G2))))
 
Upvote 0

Forum statistics

Threads
1,214,808
Messages
6,121,684
Members
449,048
Latest member
81jamesacct

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