Syncing a cell from an outside sheet to multiple rows in the master sheet with IMPORTRANGE, SPLIT, TRANSPOSE - google-sheets

I am having issues with syncing some data from an outside spreadsheet to a master spreadsheet. The problem lies in the fact that there are multiple strings in each cell of the column I wish to sync. I have tried to solve the problem by using IMPORTRANGE to get the data from the I column (starting at I2 onwards), then splitting the strings and finally transposing them to get them into rows, which works well for the master sheet. I have written it like so:
={TRANSPOSE(SPLIT(IMPORTRANGE("spreadsheet_url","sheet_name!I2:I"),","))}
The problem is in the fact that this formula only works for the first cell (I2), despite the fact that I have specified the entire I column. It gets the correct range of data, but when I use SPLIT on it, it only takes the first one into account.
What am I missing? Is there a way to include a new row as a delimiter also in the SPLIT function and in which way?
Thanks a lot.

try:
=ARRAYFORMULA({TRANSPOSE(SPLIT(IMPORTRANGE("spreadsheet_url","sheet_name!I2:I"),","))})

Related

Output array formula, ignoring cells in output area that already contain data

I'm trying to work on a Google Sheet and make it as user friendly as possible, so when I'm not around others can't screw it up. I have previously copied the formula down the column, but I'm trying to do it in an array formula, that is in the header of the column so people don't need to copy the formula to other cells.
The formula is simply a VLOOKUP, comparing a cell to the left with the code, and retrieving the title and other information later. (I've had this working happily via copying the formula down the column.)
VLOOKUP($F$2:F, 'Lessons NEW'!$E$2:$F,2,false)
My problem comes when trying to do this using an array formula in the header. This also works properly, but doesn't allow me to do somethings needed.
={"Title";
ARRAYFORMULA(
IF($F2:$F<>"",
VLOOKUP($F$2:F, 'Lessons NEW'!$E$2:$F,2,false),
)
)}
Again this works happily.
HOWEVER. my issue is that on some rows I need to manually enter some info.
What I want to happen, is rows in the column that have data, in the array formula's destination to get skipped over and simply ignored during the array formula's output and end up containing what's been manually entered in them. (Some rows in the column will just be random manual entry stuff)
I've tried doing this via checking if there is a code in the cell to the left, and try to make it skip if so, or check if the destination cell has contents already and skip if so. but it seems that if I have anything in the output area of the array formula, it breaks it completely.
Does anyone have any suggestions of how I can accomplish this? Thanks!
Unfortunately there's no direct solution within ARRAYFORMULA. If you can, and ideally there are no in between rows added, you can add a column to the left to be hidden, and contain the formula adapted:
={"",VLOOKUP($F2, 'Lessons NEW'!$E$2:$F,2,false)}
Without ARRAYFORMULA it will be able to expand at any row that doesn't have a handwritten value. You may also protect that whole hidden column (that will mean also that no in between rows will be added by noon authorised people, may be also useful for you)
UPDATE
Sample script for copying the formula. Adapt the ranges and name of the sheet:
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
SpreadsheetApp.getUi().createMenu("Custom")
.addItem("Copy Formula","copyformula")
.addToUi()
copyformula()
}
function copyformula(){
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sh = ss.getSheetByName("Sheet3")
var range = sh.getRange("D1")
range.copyTo(sh.getRange("D2:D"))
}
what you describe contradicts the intended usage of arrayformula. arrayformula is designed to roll out and for that, it needs an empty space. any manual input in that empty space will render the arrayformula out of the game. there are only two solutions for your issue:
not use arrayformula but VLOOKUP formula in every cell
use a script that will inject the formula only if there is no manual input
and one more hybrid solution - have your arrayformula in one column and your manual input in the next column, and then have 3rd column that will gather the data like if manual column is empty output vlookup otherwise output manual input

Trying to index match data from a different workbook

My colleague collects data in Google Sheet A. I want to reference and index-match some of that into my sheet B where I track the progress of projects. I've tried two different ways of doing it, and neither of them work for me.
Here are the two ways I tried:
I created a new tab in sheet B. Then I used importrange to sync with the data from sheet A. Then I used index match to reference the data from the importrange in the same sheet. Indexmatch did not work with the importrange data. Only once I copied and pasted it as values, did the data come over, but that of course broke the live synced importrange.
I tried to do the indexmatch and importrange at the same time using this formula from this forum:
=INDEX(IMPORTRANGE("SheetA",Tab"!A4:H26"),MATCH($Cell,IMPORTRANGE("SheetA",Tab"!A4:A26"),0))
But that just gave me an error.
Any other ideas on how to approach this?
use vlookup:
=VLOOKUP(A1; 'Sheet A'!A:H; 2; 0)
Maybe because it's just schematic, but have you used the quotation marks this way? --> Tab"!A4:H26"
You should use them like this --> "Tab!A4:H26"
And when you write "SheetA" you're writing the Spreadsheet Id, right??
And you should add another comma before the last parenthesis and tell which column you want to grab the final data from (1 for Column A, 2 for column B, etc.)

Split ArrayFormula throwing #valueerror when data added to cells in range

Sorry for poor formatting ahead of time.
I have a Google Sheet that collects responses from a Form. What I am trying to do is take the URLs that are made from the file upload question on the form and split them into individual URLs in the same row. I had this working without issue previously and now when making a new sheet, the formula I am using is not working and giving me unexpected errors or data. Can't embed photos yet so links below.
Formula
Value Error
The formula will copy data from the reference cell if there is no comma, but if a comma is added to any cell in the column, the entire formula stops working. I am really not sure what the problem is as I said this worked just fine previously. Thanks in advance, I've been at this longer than I care to admit and I assume this is a simple problem that I have overlooked.
The reason why you encountered such issue is because you are trying to create an array with mismatched number of columns.
Based on your sample scenario, when you used ={"File1";arrayformula(iferror(split(Q2:Q,",")))} while your column Q2:Q data doesn't have a comma, arrayformula will return 1 column results. Row1 column count and the array formula result's column count matches.
But if Q2:Q data contains comma, arrayformula will return multiple column results which doesn't match in your row 1 column count
You can use this formula in cell R1:
=arrayformula(iferror(split({"File1,File2,File3,File4,File5,File6";Q2:Q},",")))
Output:

Google sheets, two-sheet dependent conditional formatting

My problem is probably trivial ... However, I was looking for similar problems and their solutions either do not work for me or I can not apply them.
I have 2 sheets - SheetA and SheetB. They are identical. I want to select every cell in SheetA that is no longer identical to Sheet B.
I was able to use (found here on Stack Overflow) such a function in conditional formatting:
= A1 <> INDIRECT ("SheetB! A" & ROW ())
It works if the range is column A. I know that I can apply this function to each column separately, but there is certainly a way that I can apply the same formula to the whole worksheet.
Will there be anyone who can show me the correct formula?
Edit: I tried to use above formula to every column... And my file become to work very slow... So whoever wants to do the same... think again.
After some tries I decided to move everything from SheetB to SheetA. I paste it a 1000 rows under data of Sheet A. Works fine without "indirect" function. No slow downs. It is not a perfect solution but it works.
But even after my problem is solved different way, I would like to know what is the correct formula for my problem... it might be useful for the future with smaller amount of data.
Solved ;)
You should be able to use the Address function to get the address of the current cell from its row and column:
=A1<>indirect("sheetB!"&address(row(),column()))
or for case-sensitive match:
=not(exact(A1,indirect("sheetB!"&address(row(),column()))))

"Formula parse error" when querying different document

I am attempting to have a cell in Sheet B display data from a cell in External / Remote Sheet A, but it results in "Formula parse error." (ETA detail to aid searches: displaying data in one Google Spreadsheet from a different Google Sheet.)
My query:
=Query(SheetA,sheet1!A:I,"select I WHERE A=3")
I've also tried it this way:
=Query(SheetA,sheet1!$A:$I,"select I WHERE A=3",-1)
This answer courtesy of #AdamL (thank you, sir!). This was his answer that I found does work very well. When QUERY isn't directly referencing a range in the same spreadsheet, use Colx notation rather than column letters:
=QUERY(importrange("NameofGoogleSheet","SheetTabName!A:Z"),"select Col9 where Col1=3")
If referencing dynamically, use something like:
=QUERY(importrange("NameofGoogleSheet","SheetTabName!A:Z"),"select Col9 where Col1="&D19)
It is also important to note that you must first connect the sheets to each other. Until this is done, you will get column errors, etc. This is done by selecting a cell of the sheet that will display the data, and putting in an IMPORTRANGE on it, which opens a dialog for connecting them. More info: https://support.google.com/docs/answer/3093340?hl=en
I also realized (duh) that I was being stupid to have two separate files for each. I only need two sheets within the same document; 1 to serve as the database and the other to display the formatted data. I am using this for a pedigree application.
I had a Formula Parse Error problem. My mistake was that I had two brackets on my formula. I deleted one set, and it was fixed. I am not sure why, but it worked for me.
EXAMPLE:
=SUM((AB450,AB432,AB422,AB415,AB405)) - THIS GAVE ME A FORMULA PARSE ERROR.
=SUM(AB450,AB432,AB422,AB415,AB405) - THIS IS THE ONE THAT WORKED

Resources