In this tutorial, you will learn how to use wildcard characters using Google Sheets Query.
How to Use Wildcard Characters (Google Sheets Query)
The Query function in Google Sheets is the program’s most powerful and flexible feature. With this versatile tool, you can use data commands to change the data in Google Sheets. The majority of pivot table functionality may be duplicated by this single function, which takes the place of numerous others.
Google Sheets’ wildcard characters are unique symbols that can be used in formulas to replace specific characters. They are used for imperfect matches in Google Sheets calculations. Google Sheets formulae can use wildcard characters to return numbers with the same pattern.
By using the percentage symbol %, you are able to use it as a wildcard character in formulas using the Google Sheets Query.
Once ready, we’ll get started by utilizing real-world examples to show you how to use wildcard characters using Google Sheets Query.
Understand Google Sheets Query
Before using an example, you will need to understand how a Google Sheets query work.
=QUERY(data, query, [headers])
Google Sheets query requires 3 arguments:
- the data range you want to look at
- the query you want to run, in quotation marks
- an optional number indicating the number of header rows in your data
Use Wildcard Characters using Google Sheets Query
Before we begin we will need a group of data to be used for the Google Sheets query formula.
We want to extract only the data for men who are of a size M.
To begin the query formula, we select an empty cell to input the formula. In this example, it will be E2. Then, we will insert an equal symbol followed by ‘QUERY’ and an open bracket. There will be a blue question mark at the side, you can click on it to reveal the arguments needed for this function to work.
Next, we insert our argument. We will select A2: C7 as our data range, which is our first argument. Then, we will insert “Select A where B like ‘M%’ “, which is our second argument. Always remember to close any formulas with a closing bracket to signify that the formula is now complete.
By using % after ‘M’, you are extracting any cells with strings starting with the character ‘M’.
Once you press Enter, the men with a size of medium will appear. It will look something like this.
- Google Sheets Query is sensitive to upper and lower case, hence if you typed ‘m’ instead of ‘M’, the function will return no data containing this string.
- The data returned from the Query function will not be formulated. You can edit the data to your own preferences.
- Placing % in front of a character means you are extracting any cells that end with that certain character.
- Placing % in front and after a character means you are extracting any cells that contain the character.
That’s all there is to it. You are welcome to copy the example spreadsheet below to see how it is done. The most crucial lesson is to enjoy yourself while doing it.
Example Spreadsheet: Make a copy of the example spreadsheet
In this tutorial, I covered how to use wildcard characters using Google Sheets Query. Want more? Check out all the Google Sheets Tutorials.