Google Sheets : Automatically include new added cells to an existing formula - google-sheets

I have a simple question for which I have failed to find an answer, simple or otherwise!
My Spreadsheet looks like this (say)
A B C
1 Name Amount 100
2 Neil 50
3 Rose 100
4 Alex 150
Now the cell C1 contains the formula =Average(B2:B).
The problem arises when i add a new row ABOVE row 2. The existing formula in C1 gets changed to =Average(B3:B) and remains linked to the original cell as it gets pushed down, which is not what i want.
There must be a way, so I ask you, the internet for your assistance :-)

use:
=AVERAGE(INDIRECT("B2:B"))

Related

How do I code a formula to apply to an entire column in Google sheets, even when you insert a new row?

I have a basic cash flow Google Sheet that I use to track my personal finances, cash in and out of my checking account.
Here's basically what it looks like:
Column A Column B Column C
Row 1 | Water bill | -50.00 | 400.00
Row 2 | Credit card | -300.00 | 100.00 >> the formula here is =sum(C1,B2)
Row 3 | Paycheck | 2000.00 | 2100.00 >> the formula here is =sum(C2,B3)
I project this out a full year. Anytime I want to add a row, I have to manually apply the formula in column C, and then I also have to fix the formula in the row just below it, which then fixes the problem for the rest of the sheet.
In Google Sheets, Is there a way for me to hard-code a formula for Column C that would allow me to insert a new row and always have it math perfectly without having to manually add the formula, and fix the formula in the row below it?
Let me know if there would be an easier way to do this by making fundamental changes to how it's setup - this is just how I've done it for so long, and I'm looking for a way to automate this going forward.
I've heard array formula might be helpful, but I'm not sure how to set it up.
There are many kinds of ArrayFormulas and LAMBDA functions. I suggest you look into them for different cases and uses. There is one kind in particular that would serve to your purposes:
=SCAN(0,B2:B,LAMBDA(a,v,a+v))
If you put this in C2 you'll have a cumulative sum row by row. Try it and let me know!
If you want to hide the results if column B is empty you can use another ARRAYFORMULA to check if B is empty it returns empty, either way returns the SCAN result:
=ARRAYFORMULA(IF(B2:B="","",SCAN(0,B2:B,LAMBDA(a,v,a+v))))
If you need to insert a new row in between then it's quite tedious as it will mess up the formulas below it, but if you just keep appending a new entry on the bottom row, then the formula will smartly mimic the behavior above it. Then you can simply do this:
Select the current last row, then click the small dot at the end and drag it down to as much as you want
OR, Ctrl+C (Copy) the last row, then select as much empty rows beneath it as you want, then Ctrl+V (Paste)

How do I filter a large dataset in Google Sheets without getting duplicates returned?

I am trying to create a new worksheet in a Google Sheets doc where I need to filter a Master data set based on values in a specific column.
I originally did a VLOOKUP in each specific column that I wanted returned but it brough back blank rows for the corresponding rows that did not match, and eventually it broke for some reason and stopped returning the correct data.
I have been trying to find a new way to do it and have most recently been trying XLOOKUP, but it returns duplicate rows of each correct match.
The original datasheet is mostly populated itself by VLOOKUPS, drawing in information from other trackers so I feel this must be why it is falling over.
The dataset looks roughly like this:
ID
Y/N
Last Name
First Name
col
col1
col2
etc
1
Y
SMITH
A
Cell 1
Cell 2
Cell 1
Cell 2
2
N
JONES
B
Cell 1
Cell 2
Cell 1
Cell 2
There are 40+columns in the tracker but I basically want to have a new sheet where I filter and return only the 'Y' values in the Y/N column, and return columns A:N (including the ID column) without leaving blank rows between the matches, and without returning dupllicates.
I have tried everything I can think of but I just cannot make it work, so any help on the matter would be GREATLY appreciated.
Thanks for reading.
try:
=FILTER(Sheet1!A:N; Sheet1!B:B="Y")
You can also try along with player0 answer, if you want also to import the headers:
=Query(Sheet1!A:N,"Select * Where B = 'Y'"),TRUE)

copy-paste between Google sheets

I'm looking for a way to copy and paste data between 2 Google Sheets spreadsheets: in spreadsheet 1 I have a shared planner of 10 people, where each marks in his sheet personal commitments divided between morning and afternoon for each day. There are also two spaces M and P where everyone manually marks commitments with me.
In spreadsheet 2 I have the small jobs assigned to each of them with a summary line that tells me if they are free (they can do up to 3 jobs M and P).
I would like to copy the data in this row in the M and P columns in the sheet of each of them.
If you are looking to copy and paste data, you could use CTRL + C CTRL + V as suggested by #Jeremy Thille.
If you want to reference data from another sheet, you can do it this way : =NameOfYourSheet!A1, or ='Name Of Your Sheet'!A1 if the name contains spaces.
If the data is on a different spreadsheet, you have to use IMPORTRANGE function. Take a look at https://support.google.com/docs/answer/3093340.
Not sure about the javascript tag, google-sheets would have been more appropriate.
I was not able to explain it and so I send you an image of files.
I have to copy the row "Peter" in Sheet 2 and paste in sheet 1 following the date and sharing of M (morning) and P (afternoon). In suggested way it is too long, and so I thought to GS.
In image2 you find the result I would like to have
Meanwhile I find a formula that I put in Peter tab, cell marked M and P (1/10) and works very well
in B4 =transpose(query({Planning!A3:DT3};"Select "&ArrayFormula(join(", ";text(query(transpose({column(Planning!C3:BL3);mod(column(Planning!C3:BL3)-column(Planning!C3);2)});"Select Col1 where Col2=0");"Col0")))))
in C4 =transpose(query({Planning!A3:DT3};"Select "&ArrayFormula(join(", ";text(query(transpose({column(Planning!D3:BL3);mod(column(Planning!D3:BL3)-column(Planning!D3);2)});"Select Col1 where Col2=0");"Col0")))))
I have 25 people tabs with six month planning. At the end ok week I delete the related data.
How can I make automatic the work?
Meanwhile I find a formula that I put in Peter tab, cell marked M and P (1/10) and works very well in B4 =transpose(query({Planning!A3:DT3};"Select "&ArrayFormula(join(", ";text(query(transpose({column(Planning!C3:BL3);mod(column(Planning!C3:BL3)-column(Planning!C3);2)});"Select Col1 where Col2=0");"Col0")))))
in C4 =transpose(query({Planning!A3:DT3};"Select "&ArrayFormula(join(", ";text(query(transpose({column(Planning!D3:BL3);mod(column(Planning!D3:BL3)-column(Planning!D3);2)});"Select Col1 where Col2=0");"Col0")))))
I have 25 people tabs with six month planning. At the end ok week I delete the related data. How can I make automatic the work?

How to make these 3 tables communicate with each other on Google Sheets?

On the sheet with the link below, I need to do this:
In the case x exists on A and C rows, not on B row > total grade (on table 3) of x should be calculated as 10 (A+B from table 2)
And same for y and z.
https://docs.google.com/spreadsheets/d/1QW9Ansn0n4NgTkLFnKjr64xEK2JCR-6KTZWe-LKAqBc/edit#gid=0
I couldn't find a way to do this with sumif or hlookup etc.
Could you please help me solve this? It's very crucial task for my team.
Thanks in advance
I added this formula to cell B15 of the sheet and copied it down:
=SUM(ArrayFormula(IF($B$3:$C$5=$A15;vlookup($A$3:$A$5;$A$9:$B$11;2;0))))

=SUMIF Google Spreadsheet Help needed

I am new to spreadsheets and I need some help.
I created a sheet to register money to be reimbursed.
What I want to do is:
a) The total shows the total amount in Column 'C' but it will subtract the row value only if/when Column 'E' says yes.
b) The total should be on display all time in the merged cells on 'F'.
I was using this:
=SUMIF(E2:E9; "Yes"; B2:B9)
But I think am Way off.
Any kind of help is welcome.
Spreadsheet for reference: Link here
Does this formula work as you want:
=SUMIF(E:E;"No";C:C)

Resources