I'm trying to create a data array from multiple cells in one cell and fail:
My data is placed in cells from A3 to A3000. I try to paste into A1 the formula like =A3&"|"&A4&"|"&A...&"|"&A3000. The length of this formula is 29.345 characters - fewer than the limit of 50.000 characters à cell.
But just after pasting of formula into A1 I get an error from Google Sheets "Can't load the file. Try later or send bug report".
The only thing I suppose is, that there are some different limits for the length of formulas, then they are for the strings... Or does somebody know, what happens here and how could I overcome this error?
Is there any formula length limitation
yes there is but it can be surpassed - https://stackoverflow.com/a/55070275/5632629
so far my longest formula had 422 379 characters
are you sure you need to do it like that (unclear from your question) instead of just:
=TEXTJOIN("|", 1, A3:A3000)
or maybe even like (it really depends on what you want to do next):
=QUERY(A3:A3000,,999^99)
or perhaps:
=ARRAYFORMULA(A3:A3000&"|")
Based on this previous post, I think the limit for formulas is the same as for content.
I would suggest trying to solve this with a custom formula in Apps Script.
function concatValues(range) {
return range.join("|")
}
Then run your custom formula with =concatValues(A3:A3000).
Related
Edit: I initially diagnosed this problem totally wrong, so the question is entirely rewritten to reflect new understanding.
The problem can be reproduced using a Google spreadsheet with one sheet that contains one header row and a significant number of additional rows (let’s say 5,000).
I wanted column A to increment by 1, starting with A2, as long as the adjacent cell in B was not blank. I used this formula in A1:
={"SKU"; arrayformula(if($B2:$B="","",text(row($A2:$A),"000000")))}
This formula worked but caused extremely significant lag.
In one of my attempts to resolve the issue, I added a helper column before column A and split my formula into two formulas to see which function was causing the lag:
Cell A1: ={"SKU (helper)"; arrayformula(if($C2:$C="","",row($A2:$A)))}
Cell B1: ={"SKU"; arrayformula(if($C2:$C="","",text($A2:$A,"000000")))}
To my surprise, the answer was neither. The lag was completely eliminated. What is the reason? And is it possible to eliminate the lag without the need for a helper column?
use:
={"SKU"; SEQUENCE(ROWS(A:A)-5344; 1; 5344)}
update:
={"SKU"; INDEX(TEXT(SEQUENCE(COUNTA(B2:B)), "000000"))}
if you have empty cells in between use:
=LAMBDA(x, {"SKU"; INDEX(IF(x="",,
TEXT(COUNTIFS(x, "<>", ROW(x), "<="&ROW(x)), "000000")))})
(B2:INDEX(B:B, MAX((B:B<>"")*ROW(B:B))))
Im trying to import more than a 100 files into one masterfile.
The problem I'm having is that when I use query null to filter blank rows, some cells return as blank (probably because the entries to that cell's column may either be a text or number string)
Is there any way around this so that the query will just take the values/any string within the cell. I'd hate to see a lot of blank rows from the import of more than 100 files!
Appreciate any help. Thank you!
before using QUERY you can force the text format with TO_TEXT so:
=ARRAYFORMULA(QUERY(TO_TEXT({
IMPORTRANGE("id1"; "A1:A");
IMPORTRANGE("id2"; "A1:A");
IMPORTRANGE("id3"; "A1:A")}); "where Col1 is not null"; ))
keep in mind that every of your 100 importranges needs to be run as standalone fx prior to using the above formula to connect your sheets by allowing the access
Here's the straightforward version of my question:
I want to change the following formula to an array formula...
Original formula (from cell J2):
=if(F4="VM:",G4,J1)
My attempt at converting to an array formula (in cell K1):
=arrayformula(if(row(A:A)=1,G3,if(F:F = "VM:",G:G,indirect("K"&row(A:A)-1))))
This works on rows where F = "VM:", but returns a #REF error on other rows. Function INDIRECT parameter 1 value is 'K0'. It is not a valid cell/range reference.
Thoughts on how to fix this?
The more complex version of my question. i.e. Why am I trying to do this?...
I have a weird spreadsheet with data that should really be in a Wiki.
I want to create filter views for each person so they can easily filter on only their own vendors. The original formula will work, but as more vendors are added, I'd like for the formula to automatically work for those rows as well.
If there's a better way to do this, I'm listening.
I don't exactly understand your needs, but If you want to autopopulate your formula, then you only need this code in desire column in row 4 (you can change this to any other - this will autofill down from this point):
=ArrayFormula(if(F4:F="VM:",G4:G,J1:J))
Is this what you are trying to get?
After clarification:
You need this code in J2 only:
=ArrayFormula(VLOOKUP(ROW(J2:J),
QUERY({F:G,ROW(G:G)},"select Col3,Col2 where Col1='VM:'",1)
,2,1)
)
Works for you?
maybe you just need to hide errors?
=IFERROR(ARRAYFORMULA(IF(ROW(A:A)=1,G3,IF(F:F = "VM:",G:G,INDIRECT("K"&ROW(A:A)-1)))),)
I'm using Google Sheets and looking for an arrayformula that able to take a list in two columns and arrange it alternately in one column. The sheet contains about 5,000 rows, each row has more than 35 characters.
I tried this:
=transpose(split(join(" ", query(transpose(B5:C),,50000)), " "))
But then I got this message:
Please take a look at the sheet here:
https://docs.google.com/spreadsheets/d/11T1Roj1trviOSiiTZS292-4l3oODid7KLi9oGz3Z66o/edit#gid=0
Assuming your 2 columns are A and B, this formula will "interlace" them:
=query(
sort(
{arrayformula({row(A1:A3)*2, A1:A3});
arrayformula({row(B1:B3)*2+1, B1:B3})}
),
"select Col2")
Explanation, unwrapping the formula from the inside:
Each value gets a unique number, based on its row number times 2 (+1 for the 2nd column)
Everything is sorted based on this number
Only the 2nd column is extracted for the result.
There is a function for this called FLATTEN().
This works perfectly as a general solution since it takes an array of any size and outputs the items in the order they appear left-right-top-down (See here).
It can be combined with TRANSPOSE() to accomplish the same thing but in the horizontal case, and if needed blank cells can be omitted with FILTER().
EDIT:
My sincere apologies, I did not read the question carefully enough. My response is incorrect.
This should work:
={B5:B12;C5:C12}
just be careful to NOT change it to
={B5:B;C5:C}
This will start an infinite loop where the spreadsheet will increase the amount of rows in the spreadsheet to allow this output column to expand, but in doing so increases the length of the 2 input columns, meaning the length of the output column increases even more, so the spreadsheet tries adding more rows, etc, etc. It'll make your sheet crash your browser or something each time you try to open it.
In Row5:
=ArrayFormula(offset(B$5,INT((row()-5)/2),iseven(row())))
Would need to be copied down however.
I'm trying this function on Google spreadsheet without success in order to gather in a sheet a value after a VLOOKUP:
=importrange("otherurl";cell("address";vlookup(value("201608"),"All_nodevice!$A$16:$C$1000",2,false)))
I get a general error.
Does IMPORTRANGE support this kind of functionality?
What I need to do is to extract data from the cell of another sheet that has the value 201608 on its left. Since IMORTRANGE wants a cell pointer such as $A$12, I thought to do these steps:
search with a lookup the value.
convert the result in a cell pointer.
I found the right way. May be it could be useful for someone else.
=VLOOKUP(201608;IMPORTRANGE("sheet url"; "All_nodevice!$A$16:$C$1000"); 2; 0)
or
=query(IMPORTRANGE("sheet url";"All_nodevice!$A$16:$C$1000");"select Col2 where Col1=201608 limit 1")
Just the ID worked for me as well instead of the URL. I had my numbers as text, so kept getting an error at first. Silly mistake, but what you are looking up probably has to be the same kind of thing (text vs numbers).
=vlookup(Q6,IMPORTRANGE("1m9IN4_NH717VATXWLnPgTvrKxnRHwtH8z-f38r9F3zY","Props!A1:Bb400"),38,false)