I am trying to use QUERY and importrange data from another spreadsheet (Say A) into my spreadsheet (say B). However, I want to import only rows from A where Column X in A has the same name as in cell L1 of spreadsheet B.
=QUERY(importrange("https://docs.google.com/spreadsheets/d/1IJw96gEObg0fE3SF_XfEXFnilNbjLaHwUm7gctZ74/edit#gid=1403434756","Data !A2:K3000"),"Select * where Col11 = "&L1&"")
error message:
Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: JohnSmith
try this one if it works:
=QUERY(IMPORTRANGE("1IJw96gEObg0fE3SF_XfEXFnilNbjLaHwUm7gctZ74", "Data!A2:K3000"),
"select * where Col11 = '"&L1&"'")
or:
=QUERY(IMPORTRANGE("1IJw96gEObg0fE3SF_XfEXFnilNbjLaHwUm7gctZ74", "Data !A2:K3000"),
"select * where Col11 = '"&L1&"'")
and if still no luck then try to change = to matches or contains
Related
need some help
=QUERY(IMPORTRANGE("1ygkNl_q1V01x8e-XTLS-gdyTC1lsWviJPJ_sb28qz-s","'QA REJECT'!C3:K"),"select Col3,Col5,Col6,Col7,Col10,Col11,Col12 where Col7 = 'HP BOX (443X270X285)'")
Output: Error
Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: Col10
Try this
you selected Col10,Col11,Col12 and you have only 9 columns in the query from C to K.
=QUERY(IMPORTRANGE("1ygkNl_q1V01x8e-XTLS-gdyTC1lsWviJPJ_sb28qz-s","'QA REJECT'!C1:K"),"select * where Col5 = 'HP BOX (443X270X285)'")
I am trying to query an XLSX file with the following statement =query($A$2:$E$34, "select E WHERE C = '1' AND A = 'Jun-21'"), in that case, C being a country number and A being the month and year and I am not able to get a value, I receive N/A saying that it has been completed with an empty result, even though there is a number matching criteria on the dataset
try:
=INDEX(QUERY(TO_TEXT(A2:E34), "select Col5 where Col3 = '1' and Col1 = 'Jun-21'"))
I have a sheet 'Results' with data that needs to be transposed in order to query it. I only have read-only access to this sheet so changing it is not possible. I'm currently using an intermediate sheet to hold the transposed 'Results' sheet and querying that...
=QUERY('Results_Transposed'!A1:AP200, "SELECT H WHERE J >= 0")
... but I would like to remove the need for this intermediate sheet. However this ...
=QUERY(TRANSPOSE('Results'!A1:AP200), "SELECT H WHERE J >= 0")
... doesn't work. This is the error: "Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: H".
Is what I'm trying to do possible, or will I have to keep the intermediate sheet?
Try
=QUERY(TRANSPOSE('Results'!A1:AP200), "SELECT Col8 WHERE Col10 >= 0", 0)
and see if that works?
I'm trying trying to build out a stock financial analysis spreadsheet this is the example sheet. I have a financials tab where I import the balance sheet, income statement, and the cash flow statement by csv. In another tab I wrote queries that'll populate the financial statements based off of whatever ticker I put into the cell
=QUERY(Financials!B4:M, "SELECT * WHERE B = """&B2&""", ")
=QUERY(Financials!Q4:AB, "SELECT * WHERE Q = """&B2&""", ")
=QUERY(Financials!AH4:AR, "SELECT * WHERE AH = """&B2&""", ")
In the Example sheet I put a blue border where I placed those query functions. The problem I'm having is I keep getting a parse error for all 3.
Try this:
=QUERY({Financials!B4:M}, "SELECT * WHERE Col1 = '"&B2&"'")
=QUERY({Financials!Q4:AB}, "SELECT * WHERE Col1 = '"&B2&"'")
=QUERY({Financials!AF4:AR}, "SELECT * WHERE Col1 = '"&B2&"'")
Output:
Reference:
QUERY
As experienced I am in sheets concatenating strings often gets the best of me with the single and double quotes. I suggest you break the formula down. So, in another cell, get the SELECT clause string working then add back to the QUERY() function.
="SELECT * WHERE Col1 = '"&B2&"'"
This is sometimes referred to as the onion approach. If you get an error on the string formula you can break it down further until your identify where the problem is. In this case it is where you are referencing cells.
Another approach is to start with a hard coded formula then substitute the cell references:
=QUERY(Financials!B4:M, "SELECT * WHERE B = """&B2&""", ")
Becomes:
=QUERY(Financials!B4:M, "SELECT * WHERE B = 'AAPL', 1)
Then substitute 'AAPL' with a cell reference using the concatenate operator (&) and single quotes (since the entire string is using double quotes.
=QUERY(Financials!B4:M, "SELECT * WHERE B = '"&B2&"'", 1)
There is also a CONCATENATE() function which I sometimes use as well
=QUERY(Financials!B4:M, CONCATENATE("SELECT * WHERE B = '",B2,"'"), 1)
Some feel this is easier to follow without all the ampersand operators
I am currently working in the following spreadsheet
https://docs.google.com/spreadsheets/d/13KfjUhWSB-BjGyC1G8f8i8o4SPd1kFFLkjN7D6VY8Lk/edit#gid=993210576
In which I am importing data from another worksheet using IMPORTRANGE, and writing a QUERY to match the cells in column B, which correspond to a specific part number, to their corresponding cut quantity found in Column D of the imported sheet. The query I have written is as follows.
=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1kFK-ZW8QjtsLYY5twdoMNTdqobGNWIV8nAFBRdouE28/edit#gid=473793446",
"FABRICATION LOG!A78169:K"), "Select Col3 where Col4 = "&B3&" limit 1", 0)`
And is returning the error message:
Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: WFR332703
I have used ImportRange for the sheet I am linking to in sheet1 of the spreadsheet linked above, and allowed access, so the error is not there.
Sheet1 is there to display the values returned for the IMPORTRANGE so that I can manually look up values I am expecting to get. Now for some of these cells, I expect to not get a value, as these will not be in the sheet I'm importing. But for others, I am expecting a numerical value, which is not being returned. I suspect this may have something to do with the fact that there is a mismatch between Datatypes since the entries in column b are both letters and numbers, but this is only a hunch with no actual facts to back it up. If anyone has any suggestions It'd be greatly appreciated.
first, paste this into some cell and connect you sheets by allowing access:
=IMPORTRANGE("1kFK-ZW8QjtsLYY5twdoMNTdqobGNWIV8nAFBRdouE28", "FABRICATION LOG!A1")
then use the formula:
=QUERY(IMPORTRANGE("1kFK-ZW8QjtsLYY5twdoMNTdqobGNWIV8nAFBRdouE28",
"FABRICATION LOG!A78169:D"),
"select Col3
where Col4 = '"&B3&"'
limit 1", 0)
if cell B3 is number use:
=QUERY(IMPORTRANGE("1kFK-ZW8QjtsLYY5twdoMNTdqobGNWIV8nAFBRdouE28",
"FABRICATION LOG!A78169:D"),
"select Col3
where Col4 = "&B3&"
limit 1", 0)
I came here because I had a query like:
=Query(Data, "select * where i < 70", 1)
What fixed it was changing to:
=Query(Data, "select * where I < 70", 1)
The column in the where clause needs to be upper case if its a letter higher than 'd'.