Hey all I have the following formula but it isn't filling the rest of the column. It isn't even giving me an error when there is something else in a cell below it.
=arrayformula(IFERROR(QUERY(
{IMPORTRANGE("Sheet 1","Original!A:G");
IMPORTRANGE("Sheet 2","Original!A:G");
IMPORTRANGE("Sheet 3","Original!A:G");
IMPORTRANGE("SHeet 4","Original!A:G")}
,"Select Col7 where Col3='"&E4:E&"'",0), " "))
Does anyone have any idea why? If I don't use arrayformula and put the equation into each cell individually, it takes forever to load.
Change your SELECT-clause to
"Select Col7 where Col3 matches'"&TEXTJOIN("|", 1, E4:E)&"'"
and see if that helps?
Related
I tried searching for this question very hard, and only managed to find one solution that sort of works. Here's the reference: how to merge rows together if duplicate id (google spreadsheet)
His question is exactly the same as mine, and the solution partially works because sometimes google sheets have an error with custom functions and the cell just get stuck on "Loading.."
I am writing this question in hopes of being able to achieve the same results, without a custom function, using sheets native formulas.
Here's another reference to something similar to what I need: How to combine rows with same ID in Google Sheets?. It is only similar because I need the combined data to be in their own cells, and not merged into one cell.
In other words, the input:
Col A(ID) Col B(values) Col C(values)
1 sample1 sample2
2 sample2 sample4
1 newsample1 newsample2
Expected output:
Col A(ID) Col B(values) Col C(values) Col D(values) Col E(values)
1 sample1 sample2 newsample1 newsample2
2 sample2 sample4
Essentially, again it is exactly the same requirements as how to merge rows together if duplicate id (google spreadsheet), but looking for a solution using google native formula rather than a custom formula if possible.
try:
=ARRAYFORMULA(SUBSTITUTE(REGEXREPLACE(SPLIT(TRIM(FLATTEN(QUERY(QUERY(SPLIT(
FLATTEN(A1:A5&"×"&ROW(B1:C5)&COLUMN(B1:C5)&"¤"&SUBSTITUTE(B1:C5, " ", "♦")), "×"),
"select max(Col2) where Col2 is not null group by Col2 pivot Col1"),,9^9))),
" ")&"", "(^.+¤)", ), "♦", " "))
fix:
=ARRAYFORMULA(SUBSTITUTE(REGEXREPLACE(SPLIT(TRIM(FLATTEN(QUERY(QUERY(SPLIT(
FLATTEN(A3:A&"×"&TEXT(ROW(B3:H), "000000")&TEXT(COLUMN(B3:H), "000000")&"¤"&
SUBSTITUTE(B3:H, " ", "♦")), "×"),
"select max(Col2) where Col2 is not null group by Col2 pivot Col1"),,9^9))),
" ")&"", "(^.+¤)", ), "♦", " "))
I have the following table on Google Spreadsheet:
And would need to get the following transformation result:
I precise that for each vegetable i can have only 1 buy price, and 1 or several sell prices
I am pretty sure this can be achieved combining ArrayFormula() + Vlookup() but have not been able to find the right formula so far. Any help would be welcomed
Thanks in advance
Cheers
Yoann
try:
=INDEX(SPLIT(FLATTEN(QUERY(TRANSPOSE(QUERY(QUERY(
{A2:C, IF(B2:B="buy", CHAR(13)&C2:C, C2:C)},
"select Col1,max(Col3) where Col1 is not null group by Col1 pivot Col4"),
"offset 1", 0)),,9^9)), " "))
Cannot figure out how to pull the results of a query with multiple rows and columns into single cells and find their details from my lookup table. Any help is greatly appreciated.
Trying this
=ArrayFormula(
QUERY({
QUERY({A4:A16,TEXTJOIN(",",TRUE,B4:C16)}, "SELECT Col1, Col2, Col3 WHERE Col1 MATCHES 'Core 1|Core 2|Core 3' LABEL Col1 'Core ID', Col2 'Full Result'")
}, "SELECT Col2 WHERE Col1 = Col1")
)
Sheet to help
It's always a headache trying to mix Query with ArrayFormula. They don't go well together.
I arrived at a nice formula, but the catch is that it relies on you sorting your data by Core Item first. You can easily achieve this with:
=SORT(A4:C16)
For this example, I placed this formula is cell N4. Then your resultant formula is:
=ArrayFormula(
{
"Core ID", "Full Result";
UNIQUE(FILTER(N4:N,N4:N<>"")),
SUBSTITUTE(
TRANSPOSE(
SPLIT(
REGEXREPLACE(
TEXTJOIN(
",",
,
UNIQUE(
TRANSPOSE(
IF(
TRANSPOSE(FILTER(N4:N,N4:N<>""))=FILTER(N4:N,N4:N<>""),
FILTER(O4:O,O4:O<>"")&
" ("&
VLOOKUP(FILTER(O3:O,O3:O<>""),A23:B53,2,)&
") - "&
FILTER(P4:P,P4:P<>"")&
" ("&
VLOOKUP(FILTER(P4:P,P4:P<>""),A23:B53,2,)&
")",
";"
)
)
)
),
",(;,)+",
";"
),";"
)
),
",",
CHAR(10)
)
})
It uses the Group Concatenate method I've adopted for stuff like this with UNIQUE, TRANSPOSE, and IF. This can probably be solved without using the precalculated SORT by substituting all instances of the N4:N, but doing it this way saves on computation time. If you need it gone, you can also hide the column or stow it in another sheet.
If you are ok breaking apart your formula then this would be an acceptable approach.
Start by Building your query criteria.
=ArrayFormula(
QUERY({QUERY({A4:A16,ArrayFormula(B4:B16&" ("&VLOOKUP(B4:B16,A23:B53,2,false)&") -
("&VLOOKUP(C4:C16,A23:B53,2,false)&")")}, "SELECT Col1, Col2 WHERE
Col1 MATCHES 'Core 1|Core 2|Core 3' LABEL Col1 'Core ID', Col2 'ALL Result'")},
"SELECT Col1, Col2 WHERE Col1 = Col1"))
Then in another column get the unique values and lastly, join the filtered values.
=UNIQUE(E4:E17)
=Join(Char(10),FILTER(F4:F12,E4:E12 = H4))
The downside to this is you will need to have multiple columns to achieve your desired result but it is easy to follow. Good luck!
I need to concatenate the city names that a person has been to into another cell but they have to be repeated every time the name of the person comes up.
I tried using COUNTIF but couldn't get me anywhere.
I don't wanna use VB code; just formulas/functions.
Any ideas?
Here's the link to my spreadsheet
use:
=ARRAYFORMULA(REGEXREPLACE(IFNA(VLOOKUP(B2:B,
TRIM(SPLIT(TRANSPOSE(TRIM(QUERY(QUERY({A2:A&",", B2:B&"♦"},
"select max(Col1) where Col1 <> ',' group by Col1 pivot Col2")
,,99^99))), "♦")), 2, 0)), ",$", ))
I have tried to use a COUNTUNIQUE function within ArrayFormula in cell 'A2' to get a result in the range like a column B that I've set a function cell by cell. But it returns only a single value. This is my formula in cell 'A2':
=ArrayFormula(COUNTUNIQUE(D2:D7,E2:E7,F2:F7,G2:G7,H2:H7))
Any help will be greatly appreciated!
This problem has interested me for a while. Basically, the solution from #player0 seems obvious to me. But it is difficult to read.
Perhaps using combined arrays and implicit endings search is more appropriate:
=INDEX(
COUNTIF(
UNIQUE(FLATTEN(
{"" & ROW(C2:Z), ROW(C2:Z) & "-" & C2:Z}
)),
ROW(C2:Z7) & "-*"
) - 1
)
you can do it like this:
=ARRAYFORMULA(QUERY(UNIQUE(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(D2:K<>"", "♦"&ROW(A2:A)&"♥"&D2:K, )),,999^99)),,999^99), "♦")), "♥"))),
"select count(Col1) where Col1 is not null group by Col1 label count(Col1)''", 0))
or like this:
=ARRAYFORMULA({
COUNTUNIQUE(D2:H2);
COUNTUNIQUE(D3:H3);
COUNTUNIQUE(D4:H4);
COUNTUNIQUE(D5:H5);
COUNTUNIQUE(D6:H6);
COUNTUNIQUE(D7:H7)})