How to Organize Google Form Responses with Query Functions

Organizing responses from Google Forms can be challenging, especially when dealing with large datasets. Leveraging the power of query functions in Google Sheets can streamline this process, allowing you to filter, sort, and analyze data efficiently.

Here, we’ll see how to organize Google Form responses with query functions, ensuring you can manage and interpret your data with ease. Also, we’ll see how to effortlessly organize your information, making it more accessible and valuable in google form.

What is the Query Function of Google Sheets?

The QUERY function available, in Google Sheets is a tool for analyzing data. It allows users to extract information from tables using SQL syntax. This feature comes in handy when you need to filter, sort, and aggregate data especially when dealing with datasets. It also enables users to generate custom reports within Google Sheets.

How to Create a Google Sheet from your Google Form Responses

Step 1: Create a Google Form

Begin by creating a Google Form that collects the information you want to store in your Google Sheet. You can customize the form fields and questions as needed.

Create your Google form

Step 2: Share your Form

Begin by creating a Google Form that collects the information you want to store in your Google Sheet. You can customize the form fields and questions as needed.

Step 3: Collect Responses

After collecting some responses, open the Google Form and click on the “Responses” tab at the top.

Collect Responses

Step 4: Create a Google Sheet from Responses

Click on the Green Sheets icon next to the “Responses” tab to create a new Google Sheet connected to your form.

Step 5: Select Response Destination

A prompt will pop up giving you the option to either make a spreadsheet or pick from an existing one. Opt for creating a spreadsheet.

Step 6: Link Form to Sheet

A new Google Sheet will be created. It will automatically link to your Google Form, and any new responses will be added to this sheet.

link form to sheet

You can review and edit your responses in the Google Sheet. Any new responses from the form will be automatically added to the sheet as rows.

How to Use QUERY Function in Google Sheets to Collect Your Google Form Responses

The QUERY function in Google Sheets is a useful tool that helps you retrieve, filter, and organize information from a specific range within your spreadsheet data.

Step 1: Understand the Baisc structure of the Query Function

The basic structure or syntax of the QUERY function is:

=QUERY(data, query, headers)

Here,

  • Data: It is the range of data where you want to work, so it selects the set of cells.
  • Query: It describes the result you want from your data, so you write the QUERY more as instructions to the function.
  • Headers: You can specify if your data has column headers (like titles at the top of each column) using this optional parameter. Add numerical ‘1’ if the table contains a header if not then put ‘0’.)

Now, let’s understand using an example, where we are trying to sort data by name:

=QUERY(B2:I9, "SELECT B", 0)

This function will work in the cells data between B to I Columns and 2 to 9 Rows; B2:I9. The QUERY function will retrieve only column ‘B’ from the chosen data and show it in the cell where you’ve entered the QUERY function.

Make sure, you do not use any extra spaces in the function and add the query in “-”, otherwise ERROR can occur.

Step 2: Make a Named Range

As the name suggests, you can simply name the range of data that you want to select every time you use the QUERY function. It is like, labeling a set of data, so that, you can just add the name instead of putting the cell names every time.

To do this, first select the data click on “Data” from the menu, and then select “Named Range” from the options that appear.

Make a named range

On the right side, a panel will open up asking you to name the range. Just enter the name you want to give to the selected range of data.

Here, we are naming the range of data we selected as ‘ Viewers’ this will help us later.

Step 3: SELECT Keyword

  • To do so, write “SELECT” in the Query field. Now, you can select all the columns in the range by using the asterisk “*” instead of using the cell name.
  • Or if you want to select specific columns, then you can simply enter the column names in Capital using a comma after each column.
  • So, if we use specific columns and enter the Query function it will retrieve data of this column and return them in a new table.

Select keyword

Step 4: WHERE Keyword

The WHERE keyword is used to filter the data, which means the function will return data that meets the criteria you have set using the WHERE keyword. This keyword is followed by the SELECT keyword.

For Example, we want to see “viewers of OTT” who were highly satisfied with their choice of OTT platform and rated “5”.

We will write QUERY as:

=QUERY(Viewers, "SELECT * WHERE H = 5" , 0

This query will pull all the data from columns B, C, and I from our “Viewers” range and return the rows where the viewers were satisfied with their current OTT platform, and column (H) will be greater than equal to 5.

Step 5: ORDER BY Keyword

You can use the “ORDER BY” keyword in the QUERY function to sort the data in a specific column in either descending order (DESC) or ascending order (ASC), if you do not enter any of these it will take “Ascending” by default.

For example, to sort the range named “Viewers” by the “H” column in descending order, you will write the query as:

=QUERY(Viewers, "SELECT H ORDER BY H DESC", 0)

Step 6: LIMIT Keyword

LIMIT Keyword is used to Limit the number of rows the Query function will return. This Keyword comes after the ORDER BY keyword.

For example, we want the first 3 viewers from our table, then, we will write the query as:

=QUERY(Viewers, "SELECT * LIMIT 3", 0)

Limit Keyword

How to Use Query Function in Google Sheets with Multiple Criteria

In Google Sheets, data can be filtered based on various criteria using the QUERY function. The WHERE keyword in the QUERY function allows data filtering using multiple criteria. There are three logical operators, namely AND, OR, and NOT, which can be used to combine these criteria.

For example, if there is a sheet containing employee names in one column A, the total sales in another column B, and the corresponding month of those sales in a third column C, the QUERY function can be applied to extract specific data from this sheet.
 

Sample data

To accomplish this, rules like “Filtering employees with sales exceeding $100 in January” or “Retrieving a list of employees with sales in either February OR March” can be established. The QUERY function enables the retrieval of this information by applying these rules.

Therefore, Google Sheets’ QUERY function permits data filtering in various ways by employing multiple criteria.

1) Logical Operator AND

The Logical Operator AND needs two conditions to be true for a row to show in the result. For instance, if somebody wants a list of workers who both sold a certain amount and are a particular worker, like John, the QUERY function would appear as follows:

=QUERY(A:C, "SELECT * WHERE A='Charlie' AND B<1000")

To include a row using this operator, both the conditions in the “WHERE” clause must be fulfilled.

Take a look at the result, you won’t find Charlie’s April sales. Although the first condition was valid and fulfilled the second condition (sales do not exceed 1000) wasn’t fulfilled. Consequently, since both conditions weren’t satisfied, April sales weren’t included in the result.

Logical Operator AND

Note: If the criteria only require one condition to be met, then logical operator OR should be considered.

2) Logical Operator OR

The OR operator requires any one of two conditions to be true. For example, if somebody wants a list that includes employees with the name Charlie or Nishi, then the formula given below will be used.

=QUERY(A:C, "SELECT * WHERE A='Charlie' OR A='Nishi'")

Using this QUERY will give the result as shown below:

Result of logical operator OR

To include a row using this operator only one condition needs to be fulfilled on either side of the condition in the WHERE clause.

Note: If all criteria require excluding certain rows based on a condition, then the NOT logical operator should be used.

3) Logical Operator NOT

The logical operator NOT excludes rows that meet a specific condition. For example, in the given sales data list that we used above, one can use the NOT operator to find staff who didn’t sell over 1,000 in May. This will help in identifying underperforming staff.

The NOT operator can be used in a QUERY as:

=QUERY(A:C, "SELECT * WHERE NOT B > 1000 AND C='May'")

This QUERY will give a list of employee names who did not make sales more than 1000 in the month of May. The result of this QUERY is shown below.
 

Result of Logical Operator NOT

How to Use Parentheses to Combine Multiple Criteria

Parentheses in logical operators are used to control the order of evaluating conditions, ensuring that specific conditions are assessed first, which can impact the final outcome of a logical expression.

Consider the same list of sales data used in the Logical Operator section. Using parentheses can lead to different outcomes if the conditions after “NOT” are enclosed like this:

=QUERY(A:C, "SELECT * WHERE NOT (B < 1000 AND C='May')")

The result differs from not using parentheses. In this case, one row is missing from May: Nishi’s sales of 680 in May. This happens because logical operators grouped both conditions with parentheses.

When parentheses are used in a WHERE clause, the QUERY function first checks the innermost parentheses. In our example, the innermost condition (B < 1000 AND C=’May’) matches May sales row. However, when “NOT” is added outside, it means the opposite. Consequently, all other rows are selected, and Nishi’s sales are excluded.

How to Use Cell Reference in Google Sheet Query

In Google Sheets Query, using cell references for specifying conditions is possible. Conditions can be directly input into the Query formula or placed in a cell for reference. This method allows for dynamic queries. However, it’s essential to remember that the Query’s SELECT, PIVOT, and GROUP BY clauses don’t use cell references but rather column identifiers like A, B, or Col1, Col2, etc. This distinction is important to avoid confusion when using cell references in the WHERE clause of the Query.

Simple Comparison Operators in Sheets Query with Cell References

  • To understand how to use QUERY with cell reference, one must know about literals. So, what are Literals?
    Well, literals are the fundamental building blocks of data in Google Sheets that encompass values such as text, numbers, Boolean TRUE/FALSE, or various date/time formats. Think of them as the raw materials that can be used for making comparisons or performing assignments within your spreadsheets.
  • This section of the article will tell about the correct use of literals as cell reference in Google Sheets Query, using simple comparison operators which are, <=, <, >, >=, =, !=, <>.
  • Consider a Google Sheets spreadsheet containing sales data with dates in column A and corresponding sales figures in column B. The goal is to filter and display sales data that occurred on or before a specified date, with the ability to change that date easily. The spreadsheet is given below.

Sample Spreadsheet

  • In cell D1, a date like ‘2023-03-01’ serves as the filter date.
     
  • In another cell, say E1, utilize the following Google Sheets Query formula: 
=Query(A2:B, "Select * where A <= date '"&TEXT(D1, "yyyy-mm-dd")&"'")
  • This formula filters and displays all rows where the date in column A is on or before the date specified in cell D1. The filtered data will look as follows:

Result

This approach to data filtering with date literals and cell references in Google Sheets Query greatly improves data analysis efficiency, making adjustments and decision-making more flexible and responsive.

Benefits of Using Query Function in Google Sheets

Using the QUERY function in Google Sheets has several advantages:

  1. With the help of QUERY, you can easily retrieve data from datasets.
  2. Users have the flexibility to customize their data by applying filters sorting it and manipulating it according to their requirements.
  3. This function saves time by simplifying data analysis and reducing effort.
  4. It makes data aggregation effortless enabling users to create summaries and reports with ease.
  5. The QUERY function is particularly useful for generating personalized reports and visualizations, within Google Sheets.

Conclusion

In conclusion, utilizing query functions in Google Sheets to organize responses from Google Forms is a powerful technique for managing large datasets efficiently. The advantages of utilizing this function are numerous including simplified data extraction, customization through filtering and sorting options, time efficiency, comprehensive data summarization, and streamlined reporting capabilities. Familiarizing oneself with keywords such, as SELECT, WHERE, ORDER BY and LIMIT will ensure the tailoring of data retrieval and analysis

How to Organize Google Form Responses – FAQs

How to organize responses in Google Forms?

To organize responses in Google Forms effectively:

  • Use Google Forms to collect responses.
  • Responses are automatically saved to Google Sheets.
  • In Google Sheets, use sorting and filtering to organize the data.
  • Use formulas like QUERY or pivot tables for advanced organization and analysis.

What is the purpose of the QUERY function in Google Sheets?

The QUERY function in Google­ Sheets is a powerful data analysis tool that allows use­rs to retrieve, filte­r, and manipulate data from their spreadshe­ets. With its SQL-like syntax, it enable­s you to extract specific information, sort and filter data, and pe­rform aggregate functions. This makes it invaluable­ for generating reports and managing large­ datasets efficiently.

Can I use the QUERY function to sort data in ascending and descending order?

Yes, with the­ QUERY function, you can easily sort your data using the “ORDER BY” keyword. This allows you to arrange­ your information based on a specific column, whethe­r in ascending (ASC) or descending (DESC) orde­r. By specifying the sorting order, you have­ full control over how your data is organized to mee­t your needs.