Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [google-sheets-query]

Use for questions about QUERY built-in function from Google Sheets.

78
votes
3answers
118k views

How to group data in a Google Spreadsheet?

I have the following table in a Google Spreadsheet: Name | Value A | 10 B | 100 A | 20 B | 200 C | 1000 How can I create another table based on a query: select name, sum(value), ...
53
votes
4answers
155k views

How can I make some data on a Google Sheets auto-sorting?

Let's say I want Google Sheets to automagically sort some data, for example column C. How do I do that? I know that I can manually sort data by right-clicking and selecting Sort data, but this is ...
14
votes
4answers
21k views

Can I use column headers in a =QUERY?

Reading the documentation for the =QUERY function1, 2, 3, some of it seems to imply that I should be able to use column headers directly in my query. For example, the =QUERY function takes a third ...
10
votes
8answers
48k views

How to make a query with Google Spreadsheet, that checks for a date

I have a range that goes from B4:H124. All the cells in column B are dates. I would like to retrieve the data from a row (B:H), where the DATE equals to the content of a specific cell, lets say Q4. ...
10
votes
1answer
41k views

Google Sheets Query Get Row When Any of These Cells are Not Empty

So like my title states I would like to select via a Query only the rows where certain cells are not blank/empty. I have 4 pools that I have a form for collecting their chemistry. In separate sheets ...
9
votes
3answers
4k views

Is it possible to use named ranges in Google spreadsheet queries so that the columns references are kept up to date?

Using Google Spreadsheets, you can write queries. However, if you have column letters in quotes, then they aren't updated as column order changes. Is there a way to write these queries so they don't ...
7
votes
7answers
34k views

How to return DISTINCT/UNIQUE list of text via Google QUERY?

Given the list of categories and sub-categories: CatA SubCatA CatA SubCatA CatB SubCatB CatB SubCatB CatC SubCatC CatC SubCatC I'd like to return all unique main categories based ...
7
votes
4answers
10k views

Is there any way to use a formula in a Google Sheets filter view?

I have a sheet with a column of numbers. I'd like to create a filter view that only shows rows with a value greater than 500, but I can't find any way to do that. There are lots of different numbers, ...
7
votes
1answer
2k views

Using Query with column headers instead of column letters

I have a formula that I use to dynamically get the column letter for a 1-Dimensional array that are the column headers of a sheet. In order to use QUERY() with column names instead of letters. ...
6
votes
3answers
11k views

How to sort a Google Sheets Query by a custom ordering

I have a table of choir members with a “name” and a “voice type” column. How can I write a query that orders them by decreasing pitch level of the voice type (i.e. soprano > contralto > tenor > bass)? ...
6
votes
2answers
6k views

Query syntax using cell reference

I'm having trouble figuring out a fairly simple QUERY statement in Google Spreadsheets. I'm trying to use a cell reference instead of static values and I'm running into trouble. I keep getting Error: ...
5
votes
1answer
8k views

Unable to parse query string for function Query, when using IMPORTRANGE

This is the problem I'm seeing: Error - Unable to parse query string for function QUERY parameter 2: NO_COLUMND The formula is of the form: =query(importange("...", "Sheet!A:V"), "select D where ...
5
votes
2answers
8k views

Stacking multiple query formulas throws “an Array Literal was missing values for one or more rows”

I am attempting to run multiple queries where it adds rows where if F is blank, then it skips those rows, then runs the query again and replaces row F with row G. I have a much more complicated ...
5
votes
1answer
1k views

COUNTIFS returns incorrect result when applied to the output of QUERY

In my spreadsheet the chart for Negative Feedback weekly pulls data from the Query sheet, but the logic doesn't work to separates negative feedback from positive feedback. The logic works fine on the ...
5
votes
1answer
541 views

How can I stop Google Sheets charts from rounding down durations?

I've got a Google Sheets chart that displays the average pace of a day's rowing machine workouts (e.g. average the time to row 500m). It looks like this: The Query I'm using to get the data is this: ...
5
votes
2answers
2k views

How to nest IMPORTRANGE into the Query function in New Google Sheets

We have applicants who come in and fill out a form via Google Forms. I have fields that auto-populate from the Response tab into a separate tab that is organized to fit our trackers. I am looking for ...
4
votes
2answers
5k views

Get rid of row in result of Google Spreadsheets query

I use the following formula in my Google Spreadsheet: QUERY(Inkomster!A2:G;"SELECT SUM(C) WHERE G="&B3&" AND F='"&A3&"'") This returns the following (On two different rows that ...
4
votes
3answers
8k views

How to make SQL CROSS JOIN of two tables with Google Spreadsheet?

I am just figuring out how to achieve an apparently simple problem. I use to have data as in database tables in my spreadsheets. It's simple data but I often need to use =QUERY function and would be ...
4
votes
4answers
5k views

Is there a way in Google Sheets to order blank cells first?

When I sort a column in Google Spreadsheets, the blanks always seem to sink to the bottom. Can I have rows with blank cels be organized first / highest? Alternatively, is there a function wherein I ...
4
votes
1answer
2k views

Sorting unique rows by a related SUMIF column

I am putting together a worksheet to keep track of expenses. I currently have the following source table called "Expenses": A B C D 1 Date Description ...
4
votes
1answer
4k views

QUERY where column IS NOT EQUAL to ANY cell in column A of a second sheet

I want it to pull the max value from column F where the corresponding row has C matching the number 14, and A does not have any exact text matches in any cell in column A of a separate sheet. I feel ...
4
votes
1answer
3k views

Query MAX group by

I'm trying to Query in only the most recent entries of each part number. I can usually figure this stuff out but cannot figure out why it only returns the (date) and not the (part number) and (most ...
4
votes
1answer
1k views

Google spreadsheets: Find max value for a name

I have spreadsheet with 2 columns - names and values, say: John 2 Doe 8 Mary 17 John 5 Bill 12 Mary 6 John 3 What formula can I use to find the maximum value for each name? (E.g. in column C ...
4
votes
1answer
83 views

How to address the columns of an inline array?

Suppose you want to run a query against an inline array: QUERY({"apple"; "orange"; "banana"}, "select A") This yields Unable to parse query string for Function QUERY parameter 2: NO_COLUMNA. Is ...
4
votes
2answers
30k views

Query Select Where is not null vs <>'' not filtering properly

I have an issue with my query where I have numeric cells and text cells that if all are empty I do not want to retrieve them however if anyone of the cells are not empty I want to retrieve that row. ...
4
votes
1answer
8k views

Query(IMPORTRANGE) function to skip columns

I'm currently using the following function to import data from one spreadsheet to another based on a value in Column K of the source spreadsheet: =QUERY( IMPORTRANGE("URL","Sheet Name!A2:P1000"), ...
4
votes
1answer
590 views

How to Create a Google Sheets Script for Reporting 26-Week New Highs using GOOGLEFINANCE Function?

I'm looking to use GoogleSheets to display ticker symbols and prices in real-time of stocks that have created new 26-week highs, i.e. today's highest trading price is greater than any trading price ...
4
votes
2answers
2k views

Dropdown list based on the result of another cell's dropdown

I want to populate a dropdown list based on a selection of another cell's dropdown list. Here is my spreadsheet. E.g., if the user does not make a choice from D20 dropdown menu, therefore F20 ...
4
votes
1answer
7k views

Multiple conditions look up

I am having trouble building a spreadsheet, the problem its my data table. I want to be able to pull data from the table, something that will match data from column A, and column B (on the same row) ...
4
votes
2answers
10k views

Google Sheets Query to select a large range of columns without manually entering each column

I have a column with dozens and dozens of columns in it that I'm querying data from. I'm using something similar to below to do this, but I'm wondering if there is an easier way? For instance, ...
4
votes
1answer
216 views

Using QUERY command with dates

I have a column in Sheet1 that contains dates in format DD/MM/YYYY, like this: 12/10/2015 28/09/2015 28/09/2015 28/09/2015 28/09/2015 28/09/2015 28/09/2015 26/10/2015 26/10/2015 26/10/2015 26/10/2015 ...
4
votes
2answers
8k views

How to count items meeting criteria in multiple columns

In Google Spreadsheets I need to count instances of a certain value but only when they match either of two values in another column. So below I would ask for the count of all brown animals that are ...
3
votes
2answers
8k views

Google Spreadsheets Query( “where a matches '/[A-Z+]/' ”) condition

According to Google Query documentation: matches - A (preg) regular expression match. haystack matches needle is true if the regular expression in needle matches haystack. Examples: where ...
3
votes
1answer
4k views

How to VLOOKUP in a QUERY

I Have this sheet with raw data, basically names, dates, amounts of money and if they paid or not (this is the most important). What I am trying to do is to have in another sheet the same table but ...
3
votes
1answer
4k views

Query multiple data input ranges into 1 column output

Not 100% sure how to explain this, feel free to edit this with more intelligent language. I need to pull data from 2 tables in 1 sheet. Meaning, I need multiple query functions. Those query ...
3
votes
2answers
2k views

Shortcut for multiple columns in query?

What's the shortcut for =QUERY($A:$K, "select A where B contains '"&N1&"' or C contains '"&N1&"' or D contains'"&N1&"' or E contains '"&N1&"' or F contains '"&N1&...
3
votes
1answer
72 views

Google Sheets Search and Display Location

I have a table like so: +---+-----+ | A | 100 | +---+-----+ | B | 125 | +---+-----+ | C | 454 | +---+-----+ | A | 234 | +---+-----+ | A | 343 | +---+-----+ | B | 222 | +---+-----+ | C | 754 | +---+---...
3
votes
3answers
174 views

How do I get data from one Google Spreadsheets “A” into Spreadsheets “B”?

How do I get data from one Google spreadsheet A into spreadsheet B so when Spreadsheet A is modified, then Spreadsheet B also changes automatically? A formula using QUERY() and IMPORTRANGE() ...
3
votes
1answer
618 views

Construct query where condition is in the past week?

Using Google Sheets' =QUERY function, is it possible to construct a select such as follows? =QUERY('My Sheet'!B:D,"select A where C = In the Past Week")
3
votes
1answer
2k views

Comma-separated values analysis and pivot tables in Google Spreadsheets

I have an issue with comma-separated values analysis and pivot tables in Google Spreadsheets. What if I have the following dataset: Facebook, Github Developer No answer Developer ...
3
votes
1answer
86 views

Google Query language

My goal is to select (count a number of rows with data) based on a condition. My query looks so basic but it does not work. =query(A:B,"select count(B) where (A = '44')",) My result is "count" as ...
3
votes
1answer
2k views

Query is returning a single concatenated string of values THEN the rows it found

I'm getting some really weird results from my QUERY() Here is an image with an example: I'm querying for the name where No Show = "No Show". It find the correct name Name 5 but also returns a ...
3
votes
1answer
278 views

In Google Sheets, can you apply a regex to a generated range?

I have a list of UK postcodes, looking roughly like this. Entries may not be unique. A1 1AA A1 2BC A1 3PN B2 4XY B2 5LH C3 6NJ They're in a range named Postcodes. I've set up the following ...
3
votes
3answers
3k views

Import current price from website to spreadsheet

As you can probably gather from the title, the goal is to plug the current price of this product into a spreadsheet. Perhaps I'm over-complicating things, but there must be an easy way to do this. ...
3
votes
1answer
5k views

How to search multiple columns in Google Spreadsheet and return values in other columns?

I have two spreadsheets and would like to enter a value into cell A1, have it check multiple columns in a spreadsheet named 'data' and output information from other columns if it's a match. ----------...
3
votes
1answer
42 views

Is there a workaround to enable two differing data types to be pulled in a Google Sheets query?

I understand that the results of a query will be of whatever data type majorly dominates a column of data, and the rest will be set to null and appear blank. Is there any sort of workaround for this, ...
3
votes
1answer
334 views

IMPORTHTML data is sporadically changing to incorrect format

I'm hoping you can help me with my problem using importhtml with Google Sheets. It is a problem similar to Trying to use Google Sheets importHTML() to import a table. It forces content to a date ...
3
votes
1answer
5k views

Google Sheets Query group by multiple

My sheet is here, and we are looking on the sheet called "Paste". I would like a query that finds and sums the total dollar amounts when the same customer receives the same service code more than ...
3
votes
1answer
2k views

Querying data through importHTML function in Google spreadsheet

I am trying to import table data into a Google spreadsheet using the below function: =ImportHTML( "http://eciresults.nic.in/StatewiseU05.htm" , "table" , 9 ) Following is the result I get out of it. ...
3
votes
1answer
34 views

Adding particular data to particular sheets within one document

I am a bit new at this and am having a tough time getting this to work... I have multiple sheets, one main one (Submissions) which receives data from a form, then I have the sheets: Level 1, Level 2, ...