Facing a problem with making a table in Google Sheets [duplicate] - google-sheets

This question already has an answer here:
Google Sheet SUMIF not summing range
(1 answer)
Closed 3 years ago.
I am making a sheet to oversee funds
I am trying to make something like this in Google Sheets
D(n) = D(n-1) + B(n) - C(n) for the entire row of D
and so on for the entire row
I also would prefer if the remaining fund didn't show up unless a value for received or spent has been input

You can use SUMIF to get running totals of columns B and C, and subtract one from the other:
=ArrayFormula(if((B3:B="")*(C3:C=""),"",sumif(row(A3:A),"<="&row(A3:A),B3:B)-sumif(row(A3:A),"<="&row(A3:A),C3:C)+D2))

try:
=ARRAYFORMULA(IF((B3:B)+(C3:C),
MMULT(TRANSPOSE((ROW(B3:B)<=TRANSPOSE(ROW(B3:B)))*B3:B), SIGN(B3:B))+D2-
MMULT(TRANSPOSE((ROW(C3:C)<=TRANSPOSE(ROW(C3:C)))*C3:C), SIGN(C3:C)), IFERROR(1/0)))

Related

Google Sheets: Formula that returns same number of rows based on cell values [duplicate]

This question already has answers here:
Repeat whole row N times based on column value in Google Sheets
(2 answers)
Closed 4 months ago.
I have a list of users and a value that denotes how many times I want to return the user's name.
How do I set up a formula that helps me output this?
try:
=INDEX(QUERY(FLATTEN(IFERROR(SPLIT(REPT(A2:A&"×"; B2:B); "×")));
"where Col1 is not null"; ))

How to workaround Query with a mixed-data column? (google sheets) [duplicate]

This question already has answers here:
Query is ignoring string (non numeric) value
(2 answers)
Closed 5 months ago.
I have a simple Query that groups my data by months that was working fine before, but now that I've introduced a formula into my date column, it's not working anymore. (I'm guessing it's because the majority data in the column is now formulas instead of actual dates).
=Query(C5:L,"SELECT SUM(I) pivot MONTH(C)+1",1)
Is there a way for me to still get my intended Query data without removing my formulas in the date column? (Query formula is in M2)
Thank you in advance!
Link to sheet: https://docs.google.com/spreadsheets/d/1EpvLMboKJ0KeR7tTqBarF1AnAg3jelhKTkyBhwKNlK4/edit#gid=1335125620
Your formulas in Col C seem to be causing the issue since they're adding a blank space when there is no corresponding value in Col D:
=IF(D45=""," ",TIMESTAMP())
Instead, try:
=IF(D45="",,TIMESTAMP())

ArrayFormula with Average formula in Spreadsheet [duplicate]

This question already has answers here:
ArrayFormula of Average on Infinite Truly Dynamic Range in Google Sheets
(6 answers)
Closed 5 months ago.
So, right now im working on another spreadsheet project and this time i want to know how to use Average Formula with Array formula to make them automatically dragdown each time a new data entered.
Here is the picture from my spreadsheet. So i want to average them from Column CH to Column CL using average formula with arrayformula.
Example
I've tried all 'Averageif' or 'Average' and using arrayformula but it turns out '#DIV/0'
Can you guys please help me with it? Thankyou.
It's not going to work.
Average formula works on arrays so it won't change anything when you try nest it with arrayformula. For example. If you try to average 3 values from 3 columns, you could try: arrayformula(average(CH1:Ch,CI1:CI,CL1:CL)) but it will return the same result as average(CH1:Ch,CI1:CI,CL1:CL) - an average of all values from all 3 ranges.
I suggest workaround and make average manually (sum of elements divided by it's number):
=Arrayformula( (CH1:Ch + CI1:CI +CL1:CL)/3)
these days it can be done like:
=INDEX(IFERROR(1/(1/BYROW(OFFSET(CH2,,,
MAX((INDIRECT("CH2:"&ROWS(CH:CH))<>"")*ROW(CH2:CH)), 5),
LAMBDA(x, AVERAGE(x))))))
for more variations see: https://stackoverflow.com/a/65435321/5632629

Arrayformula with countif in google sheets to count duplicates until current row [duplicate]

This question already has an answer here:
How to combine ARRAYFORMULA and COUNTIF
(1 answer)
Closed 3 months ago.
I need to count the duplicates only until the current row. And I need it to be in an arrayformula as I need it to expand automatically when a new row is added
In excel I would use a table with a function looking something like:
=COUNTIF($A$2:A2,B2) -> in cell C2
In cell C10 the function would automatically become:
=COUNTIF($A$2:A10,B10)
I am not able to perform this action in google sheets:
=ARRAYFORMULA(IF(ROW(J:J)=1,"Column title", IF(ISBLANK(J:J),"",COUNTIF($J$1:J1,J:J))))
I know that $J$1:J1 won't work but am out of ideas.
Is this somehow achievable?
Something like this?
=ArrayFormula(if(A:A="","",countifs(A:A,A:A,row(A:A),"<="&row(A:A))))

How to make a cell reference never change [duplicate]

This question already has answers here:
How to maintain absolute cell address even when deleting ranges?
(2 answers)
Closed 5 months ago.
So I have an google spreadsheet, I am build a cache stats page, that just caches other sheets in the document. All the other sheets are constantly changing.
Here is an example.
I have 2 sheets in a workbook.
SheetA and SheetB
SheetA has 1 column 1 row. A1 and in A1 we have a value of lets say $50.00
SheetB has the same thing, 1 row 1 column. A1 has a formula of ='SheetA'!$A$1
If I go into SheetA and add a column to the left of A1, Google Spreadsheet updates my formula to be ='SheetA'!$B$1
I was under the impression with the $ (dollar) sign the reference should not change but it does. Any ideas on how to prevent Google from updating my formulas? Currently anytime I update the sheets I have to run a script to update all the formulas back to the original.
Try wrapping that in an indirect function. That should prevent the 'shifting'.
=INDIRECT("'SheetA'!A1")

Resources