Open navigation

How to use filters in Google Sheets queries

Filtering is a way to control the end results of your query. All the fields available to you in a data source can be used in a filter. A filter is built by choosing the field to filter by, choosing the logical operator and then entering a value to filter by. 


This guide will walk you through how to build and create filters for your Supermetrics queries.


Create a filter

Open the Supermetrics sidebar and navigate to the Filter section. Click Add filter to start the creation process.


Choose the field you wish to filter by from the Field dropdown menu. Then, choose the operator to function by, and enter your filter string. Learn more about operators below.


Once you’re happy with the filter, click Apply changes to run the query with the filter. 


Dynamic cell references

You can also use cell references as values for your filter — learn how in our guide.


Add multiple filters to one query

You can add multiple filters to a single query. You should create the filters before doing this, so they can be added to the query in the order you need them to be.


In the Filter section of the Supermetrics sidebar, click Add filter (or the plus icon) next to the filter you want to add to the query.


Next, choose AND or OR.

  • ADD means results must match all filters in order to be either included or excluded.
  • OR means that results can match any filter in the query in order to be either included or excluded.


Modify or remove a filter

You can make changes to your filters by modifying the query on the sidebar, or remove them by clicking the trashcan icon next to the filter, then clicking Apply changes.


About operators

When creating strings that include any of these operators, please note that some ignore a word’s capitalization while some don’t.


Equals, Does not equal, Contains, and Does not contain ignore a word’s case, so “TOFU 2020” and “tofu 2020” would show the same results.


However, Matches regex and Does not match regex filter values based on the string’s case, so when using either of these operators, “TOFU 2020” and “tofu 2020” would return different results.


Equals
The Equals operator compares the query results to the string you enter into the value field, and it will include only the results that match your string completely.
Does not equal

Does not equal  is the direct opposite of Equals. This operator will leave out matching results. 

Letter case is irrelevant in Does not equal (so “TOFU 2020” and “tofu 2020” would return the same results).

Contains
The Contains operator takes the string you enter into the value field, compares the query results to it, and it will include only the results that have your string as a part of them (that part still has to fully match the value you enter into the filter).
Does not contain
This is the direct opposite of Contains. This operator will leave out matching results.
Matches regex

The Matches regex operator takes the regular expression string you enter into the value field and compares it to the results, leaving in the results that match your regex string.


There are many resources available to learn more about regular expressions. For example, RegexOne offers a simple tutorial with interactive exercises.

Does not match regex
The Does not match regex operator is the direct opposite of Matches regex. This operator will leave out the matching results.

Troubleshooting

If you’re having trouble getting your filter to work properly, check these settings.


Whitespace

An extra whitespace (a space between letters, numbers, or words, sometimes left at the beginning or end of a string) can stop a filter from reading the value field string properly. Check for extra whitespaces and remove them.


Old fields

Sometimes, a filter set up in the past can contain fields that aren’t supported any longer. Check our field list to make sure your filter’s fields are still valid.


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.