Best way to make all-time leading scorers sheet from multiple sheets

confuxion

New Member
Joined
Aug 17, 2024
Messages
17
Office Version
  1. 2019
Platform
  1. Windows
So I've gone through the arduous process of collecting (in Excel) 20 season's worth of individual scoring stats for the HS hockey team my son plays for. Every season is contained in it's own sheet, with individual stats for each player. I'm looking for the best approach to creating an additional sheet that compiles an all-time leading scorers list among those 20 seasons; one that will keep the manual data-entry to a minimum. Given that high school is 4 years, many players appear on upwards of 4 different sheets. This is more about the approach in trying to collect every player and their associated career stats onto one sheet. My initial thought is to use VLOOKUPS on player names across all 20 sheets, but the best way to do this escapes me. Maybe this is simpler than I think. Thanks in advance for any tips/ideas!
 
Forgot to add: If you need help with how to implement my code, just ask. :)
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Peter, that is crazy! I'm flummoxed! I did what you said and put those 4 sheets in a separate test workbook and added the macro. It ran perfectly! I even added a new player to one of the sheets, along with his stats, and boom - ran the macro and he showed up in the totals. I feel selfish asking for more, but yes, to answer your question, I do need ordering. Sorted by PTS (points) is how the finished product should present, although, in a perfect world, the Career data gets turned into a table by which any column is then sortable.

Also, the stats I used for this example is about half of the total that each year comes with. Does anything need to be done to the code to extend out more columns for additional data? Incredible work!
 
Upvote 0
Does anything need to be done to the code to extend out more columns for additional data?
Yes, if there are more columns involved then changes will be required and it may be that a different approach would be best. Lets get the details of how many columns there actually is and whether or not every column needs to be included in the results sheet.

We will deal with any sorting/table creation once the above issue is resolved.
 
Upvote 0
Sorry, this is probably a dumb question to ask, given what I read in the rules section, but would this in any way be easier if I sent you the actual workbook? Totally understand if that's not how you roll, or how I should even suggest rolling.
 
Upvote 0
No, as a public forum #4 of the rules means that all communication should remain in the forum. It may well be that a better solution that mine might be offered and people need to all have equal access to the information and sample data so they can participate if they want. Couldn't you just post a few rows from one of the year sheets with XL2BB and explain what information from that needs to get included in the results sheet?
 
Upvote 0
Gotcha, my bad. Yes, absolutely, I can post an expansion of my data here. One minute...
 
Upvote 0
This is the full extent of the stats that have been tracked (although it's worth noting, some of the years I have are missing stats for some of the categories, but all the years have Games, G, A, PTS at the very least). Note that the PTS, Sh% (shooting %), and FO% (face-off %) are the only 3 columns that are formulaic.

2023-2024-u32-varsity-hockey-stats.xlsx
ABCDEFGHIJKL
12023 TOTALS
2Scoring
3PlayerGaGAPTSPIM+ / -ShotsFOWFOLSh%FO%
4Wayne Gretzky1955102155679.1%46.2%
5Martin St. Louis201672312067142523.9%35.9%
6John LeClair15423276-8108103623.7%62.4%
7Mark Messier194913717200572.0%41.7%
8Connor McDavid2033615-22522115.8%15.4%
9Sidney Crosby201218306528173442.9%33.3%
10Connor Bedard187162377115215856.1%71.7%
11Mack Celebrini164812534851101054.7%51.2%
12
13TOTALS20558914460347104723367.7%58.4%
2023
Cell Formulas
RangeFormula
K13,K4:K11K4=IF(ISERROR(C4/H4),0,C4/H4)
L13,L4:L11L4=IF(ISERROR(I4/I4+J4),0,I4/(I4+J4))
E4:E11E4=C4+D4
C13:J13C13=SUM(C4:C11)
 
Upvote 0
So columns C, D, F, G, H, I & J need to get accumulated onto the results sheet and the formulas in E, K & L could be re-created on the results sheet like I did with col E before?
 
Upvote 0
Yes, exactly. Column B needs to get accumulated onto the results sheet as well. I think you meant to put that.
 
Upvote 0
Confuxion,
for a try with Power Q:
  • Create table for each year data as bellow for 2023 – name table: t_2023.
1723897375347.png


PlayerGaGAPTSPIM+ / -ShotsFOWFOLSh%FO%
Wayne Gretzky1955=[@G]+[@A]215567=[@G]/[@Shots]=[@FOW]/([@FOW]+[@FOL])
Martin St. Louis20167=[@G]+[@A]120671425=[@G]/[@Shots]=[@FOW]/([@FOW]+[@FOL])
John LeClair15423=[@G]+[@A]6-810810362=[@G]/[@Shots]=[@FOW]/([@FOW]+[@FOL])
Mark Messier1949=[@G]+[@A]71720057=[@G]/[@Shots]=[@FOW]/([@FOW]+[@FOL])
Connor McDavid2033=[@G]+[@A]15-2252211=[@G]/[@Shots]=[@FOW]/([@FOW]+[@FOL])
Sidney Crosby201218=[@G]+[@A]65281734=[@G]/[@Shots]=[@FOW]/([@FOW]+[@FOL])
Connor Bedard18716=[@G]+[@A]7711521585=[@G]/[@Shots]=[@FOW]/([@FOW]+[@FOL])
Mack Celebrini1648=[@G]+[@A]53485110105=[@G]/[@Shots]=[@FOW]/([@FOW]+[@FOL])
Total=SUBTOTAL(104,[Ga])=SUBTOTAL(109,[G])=SUBTOTAL(109,[A])=SUBTOTAL(109,[PTS])=SUBTOTAL(109,[PIM])=SUBTOTAL(109,[+ / -])=SUBTOTAL(109,[Shots])=SUBTOTAL(109,[FOW])=SUBTOTAL(109,[FOL])=t_2023[[#Totals],[G]]/t_2023[[#Totals],[Shots]]=t_2023[[#Totals],[FOW]]/(t_2023[[#Totals],[FOW]]+t_2023[[#Totals],[FOL]])
  • Repeat for each year data.
  • Then Data> Get Data > From Other Sources > Blank Query > Home > Advanced Editor and remove code still present and copy/past the following code and press Done.
Power Query:
let
    Source = Table.SelectRows(Excel.CurrentWorkbook() , each Text.StartsWith([Name], "t"))[Content],
    All_Data = Table.Combine(List.Transform(Source, (x)=> Table.RemoveLastN(x,1))),
    cols = List.RemoveLastN(List.Skip(Table.ColumnNames(All_Data),1),2),
    #"Grouped Rows" = Table.ExpandTableColumn(Table.Group(All_Data, {"Player"}, {{"x",
                      each Table.FromRows({List.Accumulate(cols, {}, (s,c)=> s & {List.Sum(Table.Column(_,c))})}, cols)}}), "x", cols),
    #"Added Sh% column" = Table.AddColumn(#"Grouped Rows", "Sh%", each [G]/[Shots]),
    #"Added FO% column" = Table.AddColumn(#"Added Sh% column", "FO%", each [FOW] / ([FOW]+[FOL]))
in
    #"Added FO% column"
  • Then, load and Close To > Table and select your output sheet.
  • Change columns K and L to percentage and add total – Table Design – Total Row and update Total as your year table.
  • To update Query: Data > Refresh All.
Regards,
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,985
Members
452,540
Latest member
haasro02

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