And note that Google Sheets actually has a query() function that allows you to run SQL like queries on your datasets. Few people seem to know this, but for me it's one of the features where I prefer it to Excel.
Sharing the documentation links for the benefit of others, since it's not easily found:
Documentation for the query() function: https://support.google.com/drive/answer/3093343
Query Language Reference: https://developers.google.com/chart/interactive/docs/queryla...
However, while investigating this I found that Excel gets quite upset if you import the data from your query into the same location as the source...... :-)