When using Googlesheets and Am using the query function to only include examples where…
- User
When using Googlesheets and Am using the query function to only include examples where Col20 is greater than 10 however it is still returning results lower than 10, how should I fix this
- Assistant
To ensure that only examples where Col20 is greater than 10 are included in the query results, you need to modify the query statement. You can try the following query statement:
=QUERY(Sheet1!A1:T, "SELECT * WHERE T > 10")
This query will select all rows from columns A to T where the value in column T (which is equivalent to Col20) is greater than 10. Make sure to replace "Sheet1" with the actual name of your sheet, and adjust the column range as needed.
- User
how do i query a sheet where I want to return all entries in Column T which are greater than 10, the entries in column T are strings and must be converted to numbers
- Assistant
You can use the
QUERYfunction together with theVALUEfunction to convert the strings in Column T to numbers, and then filter the results by values greater than 10. Here's the formula you can use:=QUERY(A1:T, "SELECT * WHERE VALUE(T) > 10", 1)This formula selects all columns and rows in the range A1:T, and filters the results to only show rows where the value in column T (after conversion to a number using the
VALUEfunction) is greater than 10. The,1argument at the end specifies that the formula should treat the first row as a header row, which can be useful if your data has column headers in the first row.Note that if there are any non-numeric values in Column T that can't be converted to numbers, this formula will return an error. You can use
IFERRORto handle such cases and replace error values with blank cells, like this:=IFERROR(QUERY(A1:T, "SELECT * WHERE VALUE(T) > 10", 1), "")This formula will return blank cells wherever an error would have occurred.
- User
How to query a sheet full of strings of numbers (for example while a cell says 10 it is a really a string saying 10 not a number) in order to return only values greater than or equal to 10
- Assistant
To filter a sheet full of strings of numbers to return only values greater than or equal to 10, you can use the
QUERYfunction with theVALUEfunction to convert the strings to numbers, and then apply the filter to the numbers.Here's an example formula that demonstrates this approach:
=QUERY(A1:T, "SELECT * WHERE VALUE(T) >= 10", 1)In this formula,
A1:Tis the range of cells that you want to filter. The second argument of theQUERYfunction is a query string that tells the formula what to do. In this case,"SELECT * WHERE VALUE(T) >= 10"means "select all rows and columns where the value in column T is greater than or equal to 10". TheVALUEfunction converts the string values to numbers.The
,1at the end of the formula tellsQUERYto treat the first row as a header row. You can use this if your sheet has headers in the first row. - User
How to query a sheet full of strings of numbers (for example while a cell says 10 it is a really a string saying 10 not a number) in order to return only values greater than or equal to 10 in Googlesheets
- Assistant
To query a sheet full of strings of numbers where the cells say 10 (as a string) and not 10 (as a number), and return only values greater than or equal to 10, you need to use the
VALUEfunction to convert the strings to numbers.Here's an example formula that demonstrates this approach:
=QUERY(A1:T, "SELECT * WHERE VALUE(T) >= 10", 1)In this formula,
A1:Tis the range of cells that you want to filter. The second argument of theQUERYfunction is a query string that tells the formula what to do. In this case,"SELECT * WHERE VALUE(T) >= 10"means "select all rows and columns where the value in column T is greater than or equal to 10". TheVALUEfunction converts the string values to numbers.The at the end of the formula tells to treat the first row as a header row. You can use this if your sheet has headers in the first row.
- User
That doesn't work, it returns an error still
- Assistant
I'm sorry to hear that. If you're still experiencing issues, try this formula to see if it works to filter values greater than or equal to 10 that are stored as strings in a given range:
=QUERY(A1:T, "SELECT * WHERE T >= '10'")In this formula,
A1:Tis the range of cells you want to filter.The query string
"SELECT * WHERE T >= '10'"means select all rows and columns where the value in column T is greater than or equal to 10. Since the value you're comparing against is itself a string, you need to use single quotes to enclose it.This formula should work as long as there are no non-numeric characters in Column T. However, it is important to note that this formula will treat values as text, so if you have a mix of numbers and text in Column T, you may get unexpected results. If you need to treat the values in Column T as numbers, try formatting the column as a number first, then apply the
QUERYformula with>=10. - User
How to query to return all the data from Column A,B, and F where the values in Column G are greater than 5 and Column A does not contain the word 'Phantasmal', The data is in a different sheet titled 'Bulk Data' in the same workbook. In googlesheets
- Assistant
You can use the
QUERYfunction along with theANDandNOTfunctions to filter the data in the 'Bulk Data' sheet, and return the values from columns A, B, and F where Column G has a value greater than 5.Here's the formula that should work for you:
=QUERY('Bulk Data'!A:F, "SELECT A, B, F WHERE NOT A contains 'Phantasmal' AND G > 5",1)In this formula
'Bulk Data'!A:Frefers to a range that includes columns A to F for sheet titled 'Bulk Data'The
SELECT A, B, Fstatement will return only the values in columns A, B, and F.The
WHERE NOT A contains 'Phantasmal' AND G > 5statement will filter the rows based on the two conditions. TheNOT A contains 'Phantasmal'condition filters out rows where the value in column A contains the word 'Phantasmal'. TheG > 5condition filters out rows where the value in column G is less than or equal to 5.The
,1at the end of the formula tells theQUERYfunction to treat the first row as a header row. You can use this if your sheet has headers in the first row. - User
Query hide results lower than 10
- Assistant
To filter a range of cells to hide results lower than 10 using
QUERYfunction in Google Sheets, you can add aWHEREclause to the query that checks for values greater than or equal to 10, and then use theSELECTclause to return only the columns you want to display.Here's an example formula:
=QUERY(A1:D, "SELECT A, B, C, D WHERE D>=10", 1)In this formula,
A1:Dis the range of cells that you want to filter. The second argument of theQUERYfunction is the query string that tells the formula what to do.The
"SELECT A, B, C, D"clause specifies which columns to include in the resulting table. You can change the column letters to match the columns you want to display.The
"WHERE D>=10"clause filters the results to show only rows where the value in column D is greater than or equal to 10.The
,1at the end of the formula tells theQUERYfunction to treat the first row as a header row. You can use this if your sheet has headers in the first row. - User
the function is have is =QUERY(ImportJSON("https://poe.ninja/api/data/itemoverview?league=Crucible&type=SkillGem"),"Select Col2, Col17, Col19, Col20 where Col5='20/20' AND not Col2 contains 'Phantasmal' Limit 15",1) this imports the json data from the url https://poe.ninja/api/data/itemoverview?league=Crucible&type=SkillGem and returns Columns 2,17,19, and 20 stylized as Col2, Col17, Col19, and Col20, It also only returns cells where the value in Col5 equals the string '20/20' and where Col2 does not contain the word Phantasmal, How can I change the function to also only return where the value of Col20 is greater than 10 in googlesheets
- Assistant
You can add an additional clause to the
WHEREstatement to filter the results based on the value of Col20. Here's the modified formula:=QUERY(ImportJSON("https://poe.ninja/api/data/itemoverview?league=Crucible&type=SkillGem"),"SELECT Col2, Col17, Col19, Col20 WHERE Col5='20/20' AND NOT Col2 CONTAINS 'Phantasmal' AND Col20 > 10 LIMIT 15", 1)In this modified formula, the additional clause
AND Col20 > 10has been added to theWHEREstatement. This will filter the results to include only rows where the value in Col20 is greater than 10.Note that you can adjust the number of rows returned using the
LIMITclause. In this case, theLIMIT 15statement limits the results to the first 15 rows meeting the specified criteria. You can adjust this number or remove theLIMITstatement altogether to show all matching rows. - User
When using that command the query is still returning values smaller than 10 (for example 2, 4, 8, etc)
- Assistant
If your query is still returning values smaller than 10 even after adding the condition to filter based on Col20 being greater than 10, then it's possible that the values in Col20 are being treated as strings and not numbers. To fix this, you can convert the values in Col20 to numbers using the
VALUEfunction.Here's the revised formula:
=QUERY(ImportJSON("https://poe.ninja/api/data/itemoverview?league=Crucible&type=SkillGem"),"Select Col2, Col17, Col19, Col20 where Col5='20/20' AND not Col2 contains 'Phantasmal' AND VALUE(Col20) > 10 Limit 15",1)In this modified formula, I added
VALUE(Col20)in the clause that filters based on Col20 being greater than 10. This will convert the values in Col20 from strings to numbers before doing the comparison.Note that if there are any non-numeric values in Col20, this will result in an error. If you encounter that error, you can use the
IFERRORfunction to handle it, like this:=QUERY(ImportJSON("https://poe.ninja/api/data/itemoverview?league=Crucible&type=SkillGem"),"Select Col2, Col17, Col19, Col20 where Col5='20/20' AND not Col2 contains 'Phantasmal' AND IFERROR(VALUE(Col20),0) > 10 Limit 15",1) - User
that formula returns at error "Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "IFERROR "" at line 1, column 92. Was expecting one of: "(" ... "(" ..."
- Assistant
I apologize for the confusion. I made a mistake when writing the previous answer. In Google Sheets, you cannot use
IFERRORfunction inside aQUERYfunction. Instead, you can use theVALUEfunction with anIFfunction to handle the possible error.Here's an example:
=QUERY(ImportJSON("https://poe.ninja/api/data/itemoverview?league=Crucible&type=SkillGem"),"Select Col2, Col17, Col19, Col20 where Col5='20/20' AND not Col2 contains 'Phantasmal' AND IFERROR(VALUE(Col20), 0) > 10 LIMIT 15",1)In this formula, the
IFfunction handles any non-numeric values in Col20, by replacing them with 0. That way, the query can handle the filter conditionAND VALUE(Col20) > 10without throwing an error.Note that if there are still any non-numeric values in Col20, this will result in the expected value of zero, so you may need to adjust the filter condition to exclude those cases.
I hope this helps!
- User
I removed the iferror and i still get an error "Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "VALUE "" at line 1, column 92. Was expecting one of: "(" ... "(" ..."
- Assistant
I apologize for the confusion. The issue is that when you apply the
VALUEfunction inside aQUERYstatement that usesImportJSON, the string values in Col20 may not all be in the expected format to be converted to numbers.You can try using a combination of
REGEXMATCHandREGEXEXTRACTfunctions to extract the numeric values in Col20 and convert them to numbers. The regex pattern(\d+(\.\d+)?)matches any decimal number with optional decimal places in a given string.Here's the updated formula with this approach:
=QUERY(ImportJSON("https://poe.ninja/api/data/itemoverview?league=Crucible&type=SkillGem"), "SELECT Col2, Col17, Col19, Col20 WHERE Col5='20/20' AND NOT Col2 CONTAINS 'Phantasmal' AND VALUE(REGEXEXTRACT(Col20, '(\d+(\.\d+)?)')) > 10 LIMIT 15",1)In this formula, the
REGEXEXTRACTfunction extracts the numeric values from Col20 and applies theVALUEfunction to convert them to numbers. This will filter the results based on the numeric values in Col20 being greater than 10.Please note that this formula does not handle the case where Col20 contains non-numeric values. If there are any non-numeric values in Col20, this formula may return an error.
- User
I want to query a sheet to pull the 15 highest entries from column B but I only want to return entires where Column C is greater than 10 however all the entries in column C are strings or numbers
- Assistant
You can use the
QUERYfunction to filter a range based on values in different columns. In this case, to filter based on values in Column C being greater than 10, you need to use theVALUEfunction to convert the string values to numbers.Here's an example formula that filters data in Column B and Column C and returns the top 15 results:
=QUERY(A1:C, "SELECT B, C WHERE C > 10 ORDER BY C DESC LIMIT 15", 1)In this formula,
A1:Cis the range of cells that you want to filter.The
"SELECT B, C WHERE C > 10"statement will return the values in Column B and Column C where the value in Column C is greater than 10.The
"ORDER BY C DESC"statement sorts the rows based on the values in Column C in descending order.The
"LIMIT 15"statement limits the results to the top 15 rows.The
,1at the end of the formula tells theQUERYfunction to treat the first row as a header row. You can use this if your sheet has headers in the first row. - User
Using hte value function doesnt work in a query in googlesheets it returns an error, Regextract also returns an error
- Assistant
I apologize for the confusion. You're correct that when you use the
QUERYfunction