Linked sheets shift formula values in Google Sheets - google-sheets

I have 2 sheets in Google Sheets that are linked.
Sheet1 is the 'root source'.(Sheet1 is a Google Form sheet that automatically updates with new responses).
Sheet2 uses the formula "=Sheet1!C2" to transfer values from Sheet1 to a specific column (in Sheet2).
The formula in Sheet2 is expanded/copied so that "=Sheet1!C2" is followed by "=Sheet1!C3", "=Sheet1!C4", and so on.
The problem: Every time a new entry in Sheet1 is created (i.e. a new response is created), Sheet2 does not get a new entry (but it should since I have defined it using the mentioned formulas). When inspecting the formula, I see that cell in the formula (like C3, C4, ...) gets shifted upwards by 1.
Therefore, the cell (still in Sheet2) that was defined with the formula "=Sheet1!C3" is automatically changed to "=Sheet1!C4".
How can I prevent this automatic upwards shifting of the formula when a new response/entry is created in Sheet1 (so that it automatically arrives in Sheet2 as well)?
Thank you!

use arrayformula in row 1 in your Sheet2:
=ARRAYFORMULA({"header"; Sheet1!C2:C})

Related

Google Sheets Add Formula Automatically After New Row

I'm using Zapier to automatically send data to a google sheet and I'm looking for a solution that allows me to automatically add the formula I want in a column when a new row is added.
For example: In column K I'm using this formula:
=VLOOKUP(J2,'List of Employees'!A:B,2,false)
This VLOOKUP function is working properly but only if I double click and expand the formula.
How I can automate this and pass the formula to the next new row created by Zapier?
Clear column K and then enter in K2
=ARRAYFORMULA(IF(LEN(J2:J), VLOOKUP(J2:J,'List of Employees'!A:B,2,false),))
This formula should not be dragged down as it processes all contents of column J and create an output in column K.
I hope that helps?

Google sheets: inter-sheet formula seems to ignore MATCH criteria... (Copy data from one sheet to another using 1 Match criteria)

I have a Google spreadsheet with 5 tabs (sheets) and I want to copy rows of data from one sheet to another, IF a criteria matches in one of the sheet.
Sheet1 has hundreds of rows of data, across numerous columns. One of the columns lists dates. That column is mostly set to Date format. That date col also uses various Conditional Formatting rules. (I cannot change these or the formatting of this column!).
In sheet5 I have a formula that is supposed to look at sheet1 and find all the rows with a certain date in the date col and then copy the data in that row to a row in sheet5.
It looks like this: =INDEX(sheet1!$A1:$O2002,MATCH($B$1,sheet1!$Q:$Q,0),0)
It kind of works... if I just paste the formula in one cell in sheet5, it finds a row matching the date criteria and copies data over. But if I want to query more of sheet1, by dragging the cell down and find more rows of data to copy over... it just copies all the rows from sheet1 after the initial find... completely ignoring what it's comparing in $B$1 to $Q:$Q... I suspect that what I think it's comparing in MATCH($B$1,sheet1!$Q:$Q,0) may not be what's actually happening, hence the result not matching my expectations...
Here is a screen capture of the sheet I want to copy data from: This sheet is set up and controlled by another party. I CANNOT change data; I CANNOT change data format that is already entered (eg I can't change a col set to Date to Plain Text!) See red notes.
But I can convert Dates in col N to Plain Text in col Q. Column Q is what I am querying/comparing in the formula in the destination sheet (see second screen capture below)
Sheet1 capture: data to copy, criteria date col
In sheet5 I have this formula that queries sheet1:
=INDEX(sheet1!$A1:$O2002,MATCH($B$1,sheet1!$Q:$Q,0),0)
Here is a screenshot of what that formula produces in sheet5
Sheet5 capture: result of using formula
Notice, it kind of works...(when I just paste the formula into my starting cell... it found the one line with the criteria I set) but then if I drag B3 down to query sheet1 more... it just grabs everything, even if $Q:$Q doesn't match the criteria set in B1...
Why?
Any help or clarifying questions are appreciated. Thanks
when dragging you did not lock the rows with $
your formula:
=INDEX(Sheet1!$A1:$Q100, MATCH($B$1, Sheet1!$Q:$Q, 0), 0)
should be:
=INDEX(Sheet1!A$1:Q$100, MATCH($B$1, Sheet1!Q:Q, 0))
coz with your initial formula you just created sort of a "sliding range" by every drag-down. to understand the formula... you are indexing range A1:A100 (from row 1 to row 100) where you narrow it down to just 13th row (MATCH outputs row 13 coz there is the match found. next you drag down and indexing range changes to A2:A101 but the MATCH formula always outputs 13 so 13th row from range A2:A101 is row 14, etc.
anyway, use this in Sheet5!B3 after you delete everything in B3:B range:
=FILTER(Sheet1!A:P, Sheet1!N:N*1=B1*1)

How to make a dynamic import command from one sheet to another in google sheets

I want to build a tool that lets me insert a spreadsheet in a given format into sheet1. Then it takes some data and inserts it into a specified location in sheet2.
I am using functions in the following format at the moments:
=Sheet1!AI2
For every column, I need the data from all rows i.e sheet1 A1 to sheet2 B2, Sheets A2 to sheet B3 ...
There are hundreds of rows and I don't want to copy-paste it and manually change the row number.
Is there a way to do it like this:
=Sheet1!AI(rownumber-1)
That way it would work for all rows.
Thanks for taking the time and reading this!
Try putting this in Sheet2!B2
=ARRAYFORMULA(Sheet1!AI:AI)
or this (it will give you the same result):
=INDEX(Sheet1!AI:AI)
Be sure that Sheet2 has at leas one more row than Sheet1. Google Sheets will automatically add 500 new rows, but if the numbers of rows in those sheets are codependent than rows will be added in a loop up until the limit.

Google sheet formula that finds row name and returns column headers based on marked cells

I'm trying to return the column headers for a row that is marked with an x. The row is selected from a name in the left column. I'm stuck here.
I can illustrate what I want to do by showing these images:
Start table
The result I want is this:
Outputs of the possibilities for the first sheet
I have put more information in my Example Sheet.
Link to editable example sheet
This formula should create a table (with a single formula) with the months in one column and the headers in the second column.
=ArrayFormula({A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)})
If you'd want to 'lookup' the months you manually type in you can wrap the above in a vlookup. Example:
=ArrayFormula(if(len(L4:L); vlookup(L4:L; {A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)}; 2; 0);))
You can check out both formulas in the copy of the sheet I've made in the spreadsheet you shared.

Arrayformula for Google Sheets doesn't work as before

Some week ago, an array formula I use in Google Sheets stopped working correctly:
=arrayformula(if(row(A:A)=1,"Convert Type",if(len(A:A)=0,iferror(1/0),iferror(vlookup(C:C,'Sheet2'!$A$2:$B,2,FALSE),"Error"))))
This formula is in Sheet1 column B1, in the frozen first row. What it is supposed to do is to take the values from Sheet1 column C, compare the values from Sheet2 column A, and insert the values in Sheet1 column B for those corresponding in Sheet2 column B (from Type1 to Type2). If there is a mismatch between the possibilities in Sheet2 column A and Sheet1 column C, the new value in Sheet1 column B will be 'Error.' The formula stops when there is nothing in Sheet1 column A (Timestamp).
Now, for some reason, all the values in Sheet1 column B are set to 'Error.' Something similar happened before when Google made a back-end update, but this time I can't figure out what I am supposed to change. Any ideas?
Example Sheet
Edit: made the text clearer and added a link with example.
Just adding a extra space in your formula updates the formula to correct values and I'm unable to find the source of the error.
Regardless, the formula was unnecessarily complicated and I simplified it a bit to it's core bone version. Try this instead:
=ARRAYFORMULA({"Convert Type";VLOOKUP(C2:INDEX(C:C,COUNTA(C:C)),Sheet2!A:B,2,0)})

Resources