Count total games played in a league standings template - google-sheets

I'm working in Google sheets
I've created a league standings template here:
https://docs.google.com/spreadsheets/d/1aTJsKkORRka1f4Z3Ibb87XGq-6Sv3qFaCYSsW8D3kHM/edit?usp=sharing
The last thing I'm really hung up on is calculating the amount of games that each team has played. Basically I need the G column to use the formula for each cell to see if the corresponding team has completed their games from the 'League Scores' table.
I currently have this formula:
=countif(filter($C4:$C, $B4:$B=$J$4), "<>") + countif(filter($D4:$D, $E4:$E=$J$4), "<>")
Each team could play on either side of the league score sheet throughout the season. So my logic is that the first 'countif' function would search through the first Team name column and Scores column to see if the team name was mentioned. If it was, it would then check to see if there was any score listed at all. If true, then it would add one to the Games played counter. The second half of the formula is to check the right side of the leagues team and score columns repeating the same process.
You can see however, that the 'GP' (games played) column lists an inaccurate amount of games played per team and even saying that teams which haven't yet played a game are at 2 games played.
What am I missing?

The extra count is coming from the case when the filter returns no rows and you get #N/A. The Countif still counts it as 1.
Suggest using Countifs instead, something like
=countifs(B:B,J4,C:C,"<>") + countifs(E:E,J4,D:D,"<>")

Related

Want to rank players for each session based on number of wins, games, and then points

I want to automatically decide who's 1st, 2nd, 3rd, and 4th for each session. I want it to be decided based on the number of match wins first, then game wins if matches are equal, and then points if games are equal. If everything is equal, then have 2 players as the same position and the next one skipped (1st, 2nd, 2nd, and 4th). The highlighted cells are where I want to calculate this. Can someone please help me with this?
Sample file:
https://docs.google.com/spreadsheets/d/1Ry3BAqXF4Di5lHGlY_roDyzQz7FmTaP1XvhO6Psm4sU/edit#gid=0
I have looked online for something, but have been unsuccessful in finding a formula for 3 columns.
I don't think there's an exact formula for this. Obviously SORT or SORTN would correctly sort them, but not return ranking with equals. What I thought of is to MAP the ranking of each column's values giving and sum them, but with different "weight". *100 to the first, *10 to the second, and *1 to the third:
=MAP(B2:B5, C2:C5, D2:D5, LAMBDA(a,b,c,RANK(a,B2:B5)*100+RANK(b,C2:C5)*10+RANK(c,D2:D5)*1))
That returns something like this:
Then wrapped it in LAMBDA in order to be used as the new source of RANKING, and calculated it with the help of BYROW. But now the ranking needs to be done in reversed order. The greater values are going to equal to the ones at the bottomo of the ranking and vice versa. That's why the 0 in RANK(e,r,0) :
=LAMBDA(r,BYROW(r,LAMBDA(e,RANK(e,r,0))))(MAP(B2:B5, C2:C5, D2:D5, LAMBDA(a,b,c,RANK(a,B2:B5)*100+RANK(b,C2:C5)*10+RANK(c,D2:D5)*1)))
Let me know!
NOTE: This would work great until 9 players, if you or anyone else needs it for more, you should change 100,10,1 with the amount of players + 1 elevated to the "priority" of the category. The first one the highest. For example, for 15 players, I would multiply the first ranking by: 16^3,16^2 and 16^1. For 20 players and 4 categories: 21^4,21^3,21^2,21^1 - Hope it's clear for universalization!

A pivot table to show standings from game data

I have a game data where each team plays 2 games per week. I want to make a pivot table to get the current standings. I would expect the below data to show Team 1 is 4-0 and Team 2 is 0-4. I've tried a lot of combinations of pivot tables but just cant quite get it. Do I need an extra column for game (1 or 2 each week)?
I've tried the following pivot table configuration:
But that just leads to is saying Team 1 has 20 W's and Team 2 has 20 L's (its not just getting one unique one per game, hence why I might need game column?)
Below is sample data:

How to set a range of cells equal to a separate cell?

I'm working on Google Sheets with baseball statistics. I have one sheet that has the team names going across row 1 & underneath each team name; I have the players names.
I also have a second spreadsheet which has players names and all their statistics for a certain time frame. The issue is that on the second spreadsheet it only has the players names and doesn't tell me what team they play for?
Is there a formula that will search the first sheet for the players name and display the team name in a separate column next to the players name on the second sheet?

Tracking Volunteer Hours Using Google Sheets

I'm trying to find an efficient way to keep track of volunteer hours for each member of a high school volunteer club using Google Sheets. Right now, I have four sheets, one for members of each grade. On the horizontal axis, I list every event and how many hours they volunteer for (or don't volunteer). However, it takes up a lot of columns and I end up having to continually add columns which is a pain, especially when passing the document on for the next "generation" of club officers.
I was thinking of having one sheet for all the members and another for all the events with names and hours of each person who volunteered. The only problem is, I want the main sheet to be able to search through the event sheet for a certain name and then add the hours that correspond to that found name to the total hours on the main sheet.
Is it even possible to search through a different sheet and return a value other than the index? To return a value in a cell next to that of the name?
There are many ways to do this. For a one function solution use QUERY.

Average wins per player

I'm not really good with Java, even less with Sheets and i need help for this :
I want to create a list of average win of players using a list with several other players :
Example (I want to get the average on the right):
Conceptually this would be "for each player, see if the player match and if he won (ratio 1:1) then continue until there is no more game (or the end of the array)".
It's for a team game and we use Google Sheets a lot for it; I wanted some stats too.
JavaScript != Java.
Additionally, there's no JavaScript involved here if you're just using Sheets.
=AVERAGE(COUNTIF(A2:A7, "Win")/COUNTA(A2:A7))
Steps for understanding:
COUNTIF all cells in a range containing the text "Win".
COUNTA all cells in the same range, regardless of what they contain.
Calculate the AVERAGE of those two values using the built-in function.
A2:A7 is just an example and should be replaced with whatever range your RESULT column takes up.

Resources