I have the following Query:
=QUERY('Fleury Braz Leme'!$A$31:$I$55;"select H, I, F, E where G = '"&I39&"'")
Some values from column E are being returned, but others are not. As you can see in the case below/above, on that linked sheet, there are corresponding values:
What can I do to correct it?
try:
=INDEX(QUERY(TO_TEXT('Fleury Braz Leme'!$A$31:$I$55);
"select Col8, Col9, Col6, Col5
where Col7 = '"&I39&"'"))
Related
Please tell me the Arrayformula at C1 which converts the column A to column C,D & E as shown.
Google Sheet Link
Extra information:
Column A is actually not raw data, it is also an Arrayformula:
=ARRAYFORMULA(VLOOKUP($A:$A, TRIM(SUBSTITUTE(SPLIT(FLATTEN(QUERY(QUERY( {Sheet1!$B:$B&"^"&Sheet1!$C:$C&"^"&Sheet1!$D:$D&"#", Sheet1!$A:$A,Sheet1!$A:$A&"×"}, "select max(Col1) where Col2 is not null group by Col1 pivot Col3",1),,9^9)), "×"), "#", CHAR(10))), 2, 0))
You can check the "Sheet1" & "Extra Information" sheets to understand it.
"Sheet1" Sheet:
"Extra Information" Sheet:
This Arrayformula at B1 is what I achieved, I am not able to split this by ^ into columns as shown in 1st Image.
try in C2:
=ARRAYFORMULA(IFERROR(REGEXREPLACE(REGEXREPLACE({
VLOOKUP(A2:A, TRIM(SPLIT(FLATTEN(QUERY(QUERY({IF(Sheet1!A2:D="",,{Sheet1!A2:A&"♦", Sheet1!B2:D&"♥"}), ROW(Sheet1!A2:A)},
"select max(Col2) where Col2 is not null group by Col5 pivot Col1"),,9^9)), "♦")), 2, ),
VLOOKUP(A2:A, TRIM(SPLIT(FLATTEN(QUERY(QUERY({IF(Sheet1!A2:D="",,{Sheet1!A2:A&"♦", Sheet1!B2:D&"♥"}), ROW(Sheet1!A2:A)},
"select max(Col3) where Col2 is not null group by Col5 pivot Col1"),,9^9)), "♦")), 2, ),
VLOOKUP(A2:A, TRIM(SPLIT(FLATTEN(QUERY(QUERY({IF(Sheet1!A2:D="",,{Sheet1!A2:A&"♦", Sheet1!B2:C&"♥", TEXT(Sheet1!D2:D, "dd/mm/e")&"♥"}), ROW(Sheet1!A2:A)},
"select max(Col4) where Col2 is not null group by Col5 pivot Col1"),,9^9)), "♦")), 2, )}, "♥$", ), "♥ ", CHAR(10))))
I would like to import a set of columns from a sheet to another with a "filter" parameter which exclude some value.
My formula look like this :
=Query(importrange("URL";"sheet name!a2:be");"SELECT Col1, Col3, Col4, Col26, Col8, Col30, Col40, Col41, Col44, Col45, Col49 WHERE Col8 NOT CONTAINS 'alc'")
However I came across with this error :
#VALEUR! Unable to parse query string for parameter 2 of function QUERY : PARSE_ERROR: Encountered " "Col8 "" at line 1, column 86.
Was expecting one of: "(" ... "(" ... .
I don't know why it doesn't work, CONTAINS is a valid parameter and even after reading documentation at
Google Visualization API query language i found no error in my syntax.
Issue:
The correct syntax is NOT Col8 CONTAINS and not Col8 NOT CONTAINS.
Solutions:
=Query(importrange("URL";"sheet name!a2:be");"SELECT Col1, Col3, Col4, Col26, Col8, Col30, Col40, Col41, Col44, Col45, Col49 WHERE NOT Col8 CONTAINS 'alc'")
Another approach would be to use Col8 <> 'alc':
=Query(importrange("URL";"sheet name!a2:be");"SELECT Col1, Col3, Col4, Col26, Col8, Col30, Col40, Col41, Col44, Col45, Col49 WHERE Col8 <> 'alc'")
I have a master data with 20 columns. I use query() to extract data but it says : no column: Col15 error
=QUERY({IMPORTRANGE("15EKBUMLhbpHL-bzOTEF2mtYVbuC4sHWtZrPJqynedJ0";"'BANHANGT8.19'!A3:N")};"select Col1, Col2, Col5, Col6, Col7, Col8, Col9, Col10, Col11, Col12, Col14, Col15";0)
I expect Col15 should be shown up: Col15 is stored as plain text although it has number and text: 331-hoàng an
Probably easily fixed with
=QUERY({IMPORTRANGE("15EKBUMLhbpHL-bzOTEF2mtYVbuC4sHWtZrPJqynedJ0";"'BANHANGT8.19'!A3:T")};"select Col1, Col2, Col5, Col6, Col7, Col8, Col9, Col10, Col11, Col12, Col14, Col15";0)
to actually import the first 20 columns. Cfr comment in original post.
This is my query
#pg = ActiveRecord::Base.connection
result = #pg.execute("select sum(col1) AS col1, sum(col2) AS col2 from messages")
now
result.values gives me [[val1, val2]]
result.fields gives [col1, col2]
is there a way we can get result similar to this ?
{col1 => val1, col2 => val2}
i looked into many solutions.. no luck :(
Try this
#pg = ActiveRecord::Base.connection
result = #pg.execute("select sum(col1) AS col1, sum(col2) AS col2 from messages").first
I am trying to query ImportRange data by the condition that a column matches a value from the imported spreadsheet, but it does not work:
=Query(importRange("KEY1","namesheet1!A2:R1600"), "select Col4 where Col7 = (importRange("KEY1","namesheet2!F108:F108")) ",0)
Replace
"select Col4 where Col7 = (importRange("KEY1","namesheet2!F108:F108")) "
by
"select Col4 where Col7 = " & importRange("KEY1","namesheet2!F108")