How to Sum with limits (google sheets) - google-sheets

Background:
I have an odd issue with Google sheets, I have a bunch of tournament results lets say
Team 1 comes 1st at 10 events, 2nd at 3 events and, 3rd at 8 events.
I need to take only their top 15 events which in this case would be:
1st - 10 times
2nd - 3 times
3rd - 2 times
Then this needs to be applied to a large number of teams (around 100) and a lot of events
My Current Solution:
Currently I have a solution for tracking all total results for a given team
=sumif("first_place","team name","all total results")" I then repeat this formula for each column of results e.g. "=sumif("second_place","team name","all total results")","=sumif("third_place","team name","all total results")
Problem (need advice):
however I am not sure how to limit this to only their top X results across all events.
update
I've settle on this formula as a temporary solution
=If(COUNTIF(Team_position,H2)< 6,Sumif(Team_position,Team_Name,team_points),"Team has played more than 6 events")
It simply gives me an error once a team plays more than the required number of events

Related

Google sheets max cells limits and mitigations

I'd read online that Google sheets has a max cell limit of 5 million cells. A sheet that I'm currently working on has well and above passed that limit (including blank cells).
What is the new limit?
Also I'd manually checked how many cells I was using. Is there any
function or script that I can use to keep a check?
The sheet I'm working on is going to only get bigger and it's already lagging heavily. I'd love some suggestions on which platform I could move to next to handle such big data. There are so many options, it's mindboggling. I use Google sheets mainly for it's ease in collaboration, presentability and ease of use. Any other tool with these traits but with an ability to handle bigger data?
in the early years, it was 5 million cells. last year this was upgraded to 10 million cells
you can follow updates at: https://workspaceupdates.googleblog.com/search/label/Google%20Sheets
try:
take a look on Google DataStudio
The easiest way I found to check the cell limit was to try and add a huge amount of lines at the end of the document, which gave me this error message:
This reads: "An error has occurred: This action would increase the number of cells in the worksheet above the limit of 10000000 cells".
However, when I used one more digit, I got a different message:
That one reads: "Oops, enter a number between 1 and 5000000", suggesting the maximum number of rows you can have is 5 million, while the max of cells can be up to 10 million. I'm not sure about the columns, but I'd say it is the as the row's limit.

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:

Count total games played in a league standings template

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,"<>")

How do I create a top 3 chart list in google sheet

I have a column in google sheet that has random numbers from 1 to 20.
I want to create a chart that shows the top 3 numbers that occurred in that column.
Example:
Lucky numbers:
so on....
TIA
Let's assume the answer to my questions was 'yes', you want the three numbers that occur most often and how often they occur.
I've tried a couple of ways of doing this. One way is to sort the numbers and use FREQUENCY to get the frequencies. Then you could use a query like this to get the top 3
=query(A1:B20,"select A,B order by B desc limit 3")
Another way is to get the mode, then the mode excluding the most frequent, then the mode excluding both of the previous ones etc.
=ArrayFormula(mode(if(iserror(match(A$2:A$20,F$1:F1,0)),A$2:A$20)))
starting in F2 - you don't need to sort them.
Then you can just use COUNTIF to get how many times they occur.
Then just put them into a chart.

Summing up data from tables Ruby on Rails

What I have is a website where I add collected data of every single shift in a factory's production lines. I add data like (Quantity in tonnes). What I want is to be able to have the data of for instance; the morning, late and night shift of the (Quantity in tonnes) which are in the Shift table and are present and visible in the Shift Index view all combined and added, and added in another page which is the Days Index page (Day contains the shifts, one day has 3 shifts), so I could see the 3 shifts' data summed up together into the data combined to see as the total output of the day.
For example, in the "Quantity in tonnes", I would like 7 + 10 + 12 (These are the inputs I already have and I have added through a form to the shifts index) to be summed up, and appear in the Days index page automatically without me interfering as "29" in the Quantity of tonnes columns in it.
How is that possible to do? I can't seem to figure out how to write the code for it so that it would loop over all the inputs and constantly give me the summed out outputs.
Let me know if you need to see any parts of my code and if there is anymore info I could add for you to understand.
Have a look at the groupdate gem, it allows you to group by day, week, hour of the day, etc.
Some code from your end would help, but here's an example use, if I wanted to get revenue for past 3 weeks:
time_range = 90.days.ago..Time.zone.now
total = Sales.where('status > 2').group_by_week(:date_scheduled, Time.zone, time_range).sum(:price)

Resources