Complex Google Sheets Puzzle - Help appreciated - Link to sheet included - google-sheets

I have a finance sheet that tracks the following in different columns:
(A) Amount Already Built Into Budget for the Year [Purple]
(B) Amount Spent Year-to-Date [Red]
(C,E,G,I) Q1-Q4 Reimbursement amounts [Green]
(D,F,H,J) Q1-Q4 Hidden columns to be used to help create this function and to tick on and off based on reimbursement amount input [Gold]
(K) Reimbursement Remaining [Blue]
The amount already built into the budget needs to be divided by 4 and to show up on each quarter as reimbursed. That amount will be entered into each quarter by default with a code that divides Column A by 4. The user will replace that value each quarter by adding the column K value to the value for that quarter.
Each quarter, the user should be able to add the value in column K to the appropriate quarter and end up with zero balance in column K.
The Amount Spent Column will update monthly and include:
Expenses built into the budget to-date
Additional expenses to-date
The goal of this sheet is to allow someone to input how much was actually reimbursed in the Q1-Q4 Reimbursement amounts [Green] and to provide a tool for that person to know how much needs to be reimbursed at any given time in the Reimbursement Remaining [Blue] column.
Column K needs to still be able to function if all expenses appear in the actuals Q4--meaning, Column K will need to be zero for Q1-Q3 and only show a balance if the sum of the actuals recorded exceeds what was built into the budget.
Wow that was hard to write out.
What is a formula that could go in Column K to make this work?
I hope this makes sense to someone!
-Alfred

try:
=if(C2+E2+G2+I2=A2+B2,0,
if(AND(D2+F2+H2+J2=0,D2=0),B2-C2,
if(AND(D2+F2+H2+J2=1,D2=1),B2-C2,
if(AND(D2+F2+H2+J2=1,F2=1),B2-C2-E2,
if(AND(D2+F2+H2+J2=1,H2=1),B2-C2-E2-G2,
if(AND(D2+F2+H2+J2=1,J2=1),B2-C2-E2-G2-I2, 0)
)))))

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!

Income Statement Subtotals In Tableau Worksheet

Sample Data
First, I am trying to create your basic multi-level income statement.
Gross Sales
Discounts
Net Sales
COGS
Gross Profit
and so on. I have tried turning on subtotals for all columns. I have searched for an answer for days now, but the one example on the Tableau forum has SUM(Amount) only. It has various different groups; covering the income statement categories. This example has a grouping of groups. I can mimic this, but it gets me no closer to, for example, calculating gross profit (net sales minus cost of sales). For presentation purposes, all of the values need to be positive, except of course if there is negative gross profit; e.g., a loss. Therefore, for some subtotals I am subtracting one subtotal from another. I am relatively new to Tableau and I am at a dead end since I don't know where to turn. My data sheet is simply an Excel workbook with transaction date, account, product, product category, and amount.

Find Number of Days in Current Month That Fall Between Date Range In Google Sheets

I'm trying to come up with a function that will calculate a monthly budget from within a specified date range. I tried to use SUMIFS but I can't figure out how to isolate a specific month within the range.
Example:
We have a sheet with Google Ad campaigns, with a row for each campaign.
We are running one Google Ad campaign (A) from 2/15/20 to 5/15/20 with a total budget of $3000 from which I calculate a daily budget of $33.33.
We are running a second campaign (B) from 5/15/20 to 8/15/20, also with a budget of $3,000, from which I calculate a daily budget of $32.61.
=IF(NOT(ISBLANK(Start_Date)),Total_Budget/(End_Date-Start_Date),"")
In a separate sheet, I have Budget and Spend fields for each month. For May, I need it to calculate the total budget for 5/1-5/15 of Campaign A, and 5/15-5/31 of Campaign B.
I got this far (J is the Daily_Budget, G is the Start_Date, and H is the End_Date):
=SUMIFS(Google!J2:J30, Google!G2:G30,"<="&DATE(2020,5,1),Google!H2:H30,">="&DATE(2020,5,31))
Then I was at a loss for how to extrapolate the number of days from the range, so that I could then multiply them by the Daily Budget and then add them together.
I thought of going back to the sheet that contains the campaigns and adding columns for each month with a complicated conditional, and then just using SUM(), but I feel like there has to be a more elegant solution.
UPDATE
Per request, here is a link to the spreadsheet with the desired results manually entered: Click here. May & June show the campaign partial month overlaps. The result I'm ultimately going for is =(15*Google!J2)+(16*Google!J3).
UPDATE 2 (24Jun20)
Per request, I have shared the spreadsheet so that people can make a copy and experiment with formulas: Click here..
Any ideas?
Thanks,
Ty
I would use the function DATEDIF() (documentation here). You can set the first parameter as the first day of the month you are trying to calculate the number of days within it, and the second as the first day from another month. Example:
DATEDIF(DATE(2020, 1, 1), DATE(2020, 2, 1), "D")
You could probably make a custom function with this as well to input only the number of each month (and year, in case of leap years on February), but I don't have much experience with that unfortunately.

Sum every nth cell in a row infinitely

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.

Resources