Repeat dynamic pattern in column after amount is greater than X - google-sheets

I am trying to create a savings spreadsheet where people save X amount of days in a week after they have reached X amount in income.
Can any Google Sheet experts help me achieve the following:
When the "amount" >= "min amount" (C1) then repeat the number of No's and Yes's according to the pattern (number of consecutive days) in B2 and B3
Example image:
example google sheet image
Example Google Sheet:
https://docs.google.com/spreadsheets/d/1n4Jg_uZUHBKi36S7HnkWWqqBTSTo3nKY9QgWP7wK9_o/edit?usp=sharing

Here's a possible solution.
={"SAVE:";ArrayFormula(if(A11:A52<C1,"NO",
{if(sequence(countif(A11:A52,"<"&C1)),);
array_constrain(flatten(split(concatenate(transpose(
if(sequence(1,countif(A11:A52,">="&C1)),
rept({"YES";"NO"}&"❄️",C2:C3)))),"❄️")),countif(A11:A52,">="&C1),1)}))}

Related

Google sheets Product function with Month comparison

I want to multiply a range by another range in another sheet only If a month in a date from a range matches the month in another range in another sheet.
Technically:
Multiply $R$8:$R$1007 by Start!$L$13:$L$24 If ARRAYFORMULA(TEXT($N$8:$N$1007,"MMMM")),"="&Start!$K$13:$K$24
Edit: here's a sample of my tables:
https://docs.google.com/spreadsheets/d/1A0zZ1BvRnjeQQjsf4RoRGesOPNYOJWzlr9Kh2oYto-Y/edit?usp=sharing
I want the income from US dollars to another currency with conditions.
So in other words column T in sheet Transactions to be equal to the multiplication of the income in US dollars by the exchange rate in column L in sheet Start only If the month from column N equals in sheet Transactions the column K in sheet Start.
How can I right turn this into a functional formula, please?
try:
=ARRAYFORMULA(IFERROR(VLOOKUP(MONTH(N8:N),
{MONTH(Start!K13:K24&1), Start!L13:L24}, 2, )*R8:R))
Based on the limited information of your sheets. The following would multiply and sum each range if the months are matching:
=SUMPRODUCT(--(TEXT(N8:N1007,"mmmm")=Start!K13:K24),R8:R1007,Start!L13:L24)

COUNTA by month and by exclusion in Google Sheets

HERE IS A SAMPLE SHEET WITH SOLUTION WORKING:
https://docs.google.com/spreadsheets/d/1Twc9i7D5rDvT_Q88thrwjV8E58Ja7c-ifdlCZDwu6Ok/edit?usp=sharing
I have a Google Sheet where I have registries that come from a Google Forms for some sort of Help Desk registry. I'm trying to make a general report tab where things are count, in total and for the current month.
For example, I'm counting how many entries are classified as 'open' and 'ended'
For the global total of 'open' registries I have:
=COUNTA(QUERY(INDIRECT("Responses!$N2:$N"), "where not N contains 'Ended'", 0))
And for the closed/ended registries I have:
=COUNTIF(INDIRECT("Responses!$N2:$N"),"Ended")
That works fine. Column "B" is a timestamp and Column "N" just lists the status as "Ended" or something else. But when I try to count by month it fails. I'm trying to use:
=COUNTA(QUERY(INDIRECT("Responses!$N2:$N"),
"where not N contains Finalizado'",
INDIRECT("Responses!$B2:$B"),
">"&EOMONTH(TODAY(),-1),INDIRECT("Responses!$B2:$B"),"
<="&EOMONTH(TODAY(),0))")")
Can anyone pinpoint the error in the formula?
I also checked these but still no idea where exactly the error is: (Google Sheets, increment cell by month)
(Sum by month in Google Sheet)
(Google Sheets =MONTH works but MONTH in QUERY does not)
(Calculate number of rows with current month & year in Google Sheets or Excel)
try like this:
=COUNTA(IFERROR(QUERY(INDIRECT("Responses!B2:N");
"select N
where not lower(N) contains 'finalizado'
and month (B)+1 = "&MONTH(TODAY()); 0)))

Need help creating a formula for dynamic average of last 4 weeks expenses

I am looking to create a spreadsheet that my staff fill out, it then gives me a master sheet with all the data, then I import dynamically to my financial spreadsheet telling me the average cost of my client over the last 30 days.
I am looking to create an AVERAGE formula of the last 30 days when Date = Today (Monday) (I want the weekday Monday as that's when staff hand in invoices)
Hope this makes sense, it's really tough!
Here's a video of me explaining my desired outcome
https://www.loom.com/share/3a9cb75052b246d1af2ba2f9ce9180a7
I've followed several guides & can't figure it out.
=ArrayFormula(iferror(query(average(if(today() - weekday(today(),3)-30)))))
I expected $90 average and I just get blank
You could use this formula:
=AVERAGE(VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)+1,A:H,2,FALSE),VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)-6,A:H,2,FALSE),VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)-13,A:H,2,FALSE),VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)-20,A:H,2,FALSE))
To break it down in to its component parts, the AVERAGE is taken from VLOOKUP results:
VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)+1,A:H,2,FALSE)
The VLOOKUP is looking for the last Monday from the current date:
TODAY()-WEEKDAY(TODAY(),2)+1
Then
TODAY()-WEEKDAY(TODAY(),2)-6
and so on...
When using on your sheet, you will have to specify the column you want to reference in your look up, for colunm B (brand1) use: A:H,2,FALSE), for colunm C (brand2) use: A:H,3,FALSE), for colunm d (brand3) use: A:H,4,FALSE) and so on...
=INDEX(QUERY({INDIRECT("A2:D"&ROW()-1)},
"select avg(Col2),avg(Col3),avg(Col4)
where Col1 <= date '"&TEXT(TODAY(), "yyyy-MM-dd")&"'
and Col1 >= date '"&TEXT(TODAY()-30, "yyyy-MM-dd")&"'"), 2, )

Calculate weekly sum in spreadsheet using array formula

I'm trying to calculate weekly sums in a single column, but I'm having trouble writing the formula. I'm found the the weeknum for every date in the year, but I can't find a way to sum up values if they have the same weeknum.
Link to my spreadsheet: https://docs.google.com/spreadsheets/d/1WIeBpRndO9ZBlkCcWQuNO1X4e9I6bGeQiYDTZqhaOeA/edit#gid=0
I'd like column "D" to automatically calculate the weekly sum using an array formula -- is there a way to do this?
This thread introduces the problem: Calculate weekly and monthly total in spreadsheet.
Chang sum() to sumif()
=ARRAYFORMULA(IF(ROW(A:A)=1,"Weekly Sum", IF(WEEKDAY(A:A)=7, sumif(C:C,C:C,B:B),)))
You have: A2:A with dates and B2:B with values. So:
F2=arrayformula(if(isblank(A2:A),,weeknum(A2:A)))
G2=if(F2<>F1,sum(iferror(filter(B$2:B,F$2:F=F2),0)),0)
And then copy G2 through G3:G.

Trouble combining Google Spreadsheet time calculation with isblank function

I'm currently using a Google Spreadsheet at work to track employee hours. I had been using a formula to calculate hours, with hours worked expressed as a time (e.g. 6 and a half hours shows as 6:30). My boss has asked that I change the hours worked total to numbers (e.g. 6.5 instead of 6:30).
I had been using the following formula to calculate hours worked in time (where B is the out time and A is the in-time):
=if(isblank(B1),"", MINUS (B1,A1))
For calculating hours worked expressed in numbers, I have been trying to use the following formula:
=(IF(A1 <= B1, 0, 1)+B1 - A1) * 24
Now, this formula works when inputted into C1, but I'd like C1 to read as blank ("") until a value is inputted into B1, because otherwise it will show a value once I put something into A1.
Can anyone lend some insight?
You should be able to check that there are three values with COUNT(A1:C1).
=if(COUNT(A1:C1)<3, "", (IF(C1 <= B1, 0, 1)+B1 - A1) * 24)

Resources