Sum every nth cell in a row infinitely - google-sheets

I am making a spreadsheet for my football (or soccer) team, and tracking how much each player has paid and whether they're in credit/debt so I'm calculating the balance in Sheet1 per game and then in Sheet2 calculating the total balance.
The formula I am trying to do is, in Sheet2 trying to SUM each value under the "Balance" column for (every 3 cells) for Aidan together to get the total balance.
At the moment I am just doing the following but need it to accommodate an infinite amount of columns (fixtures) and be scalable because currently, this is not.
=SUM(Sheet1!D3, Sheet1!G3)
Any help would be massively appreciated.

you can use FILTER of MOD in SUM like:
=SUM(FILTER(B2:2, MOD(COLUMN(B2:2)+2, 3)=0))

Since the goal is to sum all values from columns with header "Balance", you could also do this:
=sumproduct(Sheet1!$B$2:$J$2="Balance",Sheet1!B3:J3)
That way you don't have to worry about the index of those columns, should you ever decide to add more columns to your sheet.

Related

Trying to only SUM values in one column based on if the adjacent cells in another column contain a formula

So I'm creating a Google Sheets doc that contains my hours and overtime for an hourly position I have, and how much overtime I'll need to make the amount of money I need to make to survive.
In addition to this I am also trying to track my hours so I can track the actual amount of money I'm making.
So I have a projected clock out time in Column B that uses a formula to tell me what time I need to ideally clock out at based on how many hours I need and what time I clocked in at. When I clock out, I enter the actual time I clocked out at.
In Column C I have the total amount of hours I worked that day, formatted in duration based on the difference between the value in Column A and Column B. If I haven't entered in a value in Column B, it shows me the ideal amount of hours I need that day.
I want to calculate my actual hours worked per week as I'm working that week, so I need to ONLY sum the values in Column C if the adjacent value in Column B is NOT a formula. So I need it to sum the values in column C if I've entered the actual time that I clocked out at in column B.
I've looked up this question and tried multiple solutions I've found here, even tried troubleshooting with ChatGPT, but most are just trying to sum the range that contains the values/formula, and not summing a different column based on if another column has formulas or not.
There seems to be a lot of posts that come super close but don't seem to work for how I need this to work.
Edit: Here is the example sheet.
So F3:F6 are values that have been manually entered, while F:7 has been calculated by a formula.
I need H9 to sum the values of H3:H7, but only the values adjacent to the times in the F column that have been manually entered. In this example, I need it to sum H3:H6 and ignore H7 until I enter a time and remove the formula in F7.
try:
=SUMPRODUCT(MAP(F3:F7,LAMBDA(z,IFNA(FORMULATEXT(z),1))),H3:H7)
You may filter and check if there is a formula with FORMULATEXT. If there isn't it will throw a #N/A error. Then with ISNA it will keep the values in which its adjacents did'nt have a formula:
=SUM(FILTER(C:C,BYROW(B:B,LAMBDA(b,ISNA(FORMULATEXT(o))))))

Calculate a percentage for subtotals in a Pivot Table - Google Sheets

I have a pivot table that is pulling in quarterly sales data and splitting it up by lead source. I want to calculate the percentage of leads brought in by each person as compared to the subtotal of jobs per quarter.
The problem I am running into is I cannot figure out how to get the subtotal as a number in my calculated field. The equation is simple- total leads per lead source divided by total number of leads. But because I have the pivot table split up by lead source, I cannot get the subtotal to calculate.
In my screenshot, you will see the "% of Total Jobs" column looking correct in the 2021-Q4 category. This is because I just did the Calculated field as "=counta(Project)/16." This is what I want it to look like dynamically for each quarter, with the "16" being replaced with whatever the subtotal of that quarter is. For instance, for Q3, that number should be 14.
The solution might be right under my nose and I'm not thinking of it.
Google Sheets screenshot of pivot table
Thank you!

Average instead of Sum in Grand Total of Pivot Table in Google Sheets

In Google Sheets, is there any way that the "Grand Total" of a column in a Pivot Table is something different than the values of the column represents? (for instance, in a sum column, show the average).
An example would be in a sheet with daily sales of several products. You want in the column for each product to show the yearly sales (sum column), but the grand total to show the average of the values in the column.
This is very easy to do in Excel, since you can configure the Grand Total to be other function. I have not been able to find the same functionality in Google Sheets.
Edit: Original question was badly formulated.
Though it reads Grand Total, the presented result depends on the choices you make on Summarise by as clearly seen in the image.
In our example for Days the Grand Total is the average of all days.
For Points the Grand Total is the minimum of all points

Calculating rows that match a month in the header

I'm trying to calculate the monthly totals for fruit that I record sales of weekly.
I have a table that records the above data.
I would like another table that calculates the SUM values for each month for that fruit. Because every month has a potentially different number of weeks, I need a formula to essentially cycle through the weeks for the particular fruit I'm interested in and SUM the values for that month dynamically.
I've tried a bunch of different things, like:
=IF(A3:A5="Banana", SUM(INDEX(C2:J2,,MATCH("January",C3:F3))))
...in the hopes that I could somehow:
Search for a fruit in a table
If found, run through the weeks and
calculate monthly values
Spreadsheet here
In B9 try this formula
=sum(filter(filter($C$3:$5, month($C$2:$2)=column()-1), $A$3:$A$5=$A9))
Fill down and to the right as far as needed.

SUMIF/SUMPRODUCT match multiple criteria within date range

I have a table (Sales) data that has two sets of columns with code, amounts and date reference:
And I have another table (Sheet1):
which need to sum the total net amount with one set subtract the other set on the Sales table but it have to matched the code and based on the weekly date range in Sheet1 table. I can sum the total amount together but I can't separate it with date.
Try:
=SUMIFS(Sales!I:I,Sales!F:F,$A4,Sales!G:G,$C4,Sales!H:H,">="&Sheet1!D$1,Sales!H:H,"<="&Sheet1!D$2)
IF you want the difference between the sum of the blues and the sum of the reds subject to the same conditions, repeat the above (with adjustments to suit) at the beginning and link the two together with a -.
I've work this one out. This is my formula:
=SUMPRODUCT(--(Sales!$C$1:$C$1000>=$C$1),--(Sales!$C$1:$C$1000<=$C$2),--(Sales!$A$1:$A$1000=A4),Sales!$D$1:$D$1000)-SUMPRODUCT(--(Sales!$H$1:$H$1000>=$C$1),--(Sales!$H$1:$H$1000<=$C$2),--(Sales!$A$1:$A$1000=A4),Sales!$I$1:$I$1000)

Resources