What's the best way to sort and categorize data across multiple Google Sheets?

I’m working on a project where I need to sort info from one main Google Sheet into different sheets based on specific criteria. Here’s what I’m trying to do:

My main sheet has a list of people and their favorite foods, like this:

Person | Food
1      | Pizza
2      | Sushi
3      | Pizza
4      | Tacos

I want to automatically create separate sheets for each food type. So the ‘Pizza’ sheet would look like:

Person | Food
1      | Pizza
3      | Pizza

Is there a way to do this without leaving blank rows for people who don’t like that food? I’ve tried using VLOOKUP and INDEX/MATCH, but I’m stuck. Any ideas on how to make this work? It would save me tons of time if I could figure out a good system for this. Thanks!

A robust solution for your data sorting needs would be to utilize the FILTER function in combination with array formulas. This approach allows for dynamic updating as your main sheet changes. In each food-specific sheet, you could use a formula like:

=FILTER(MainSheet!A:B, MainSheet!B:B=A1)

Place the food name in cell A1 of each sheet. This formula will automatically pull all matching entries from the main sheet, adjusting as data is added or removed. It’s efficient and doesn’t require script writing. For best results, ensure your main sheet data is in a table format with headers.

hey there! u could try using QUERY function for this. it’s pretty powerful. something like =QUERY(MainSheet!A:B, “SELECT * WHERE B=‘Pizza’”) should do the trick. just change ‘Pizza’ to whatever food u want for each sheet. it’ll automatically filter n remove blank rows. hope this helps!

I have dealt with similar data sorting challenges before, and I found that using Google Apps Script can be a game-changer. By writing a script that goes through your main sheet to identify unique food types and then creates new sheets for each type, you can dynamically copy the relevant rows without leaving blank spaces. Although it might take a bit of time to learn the basics of Apps Script, its automation power makes it a very effective method for handling large datasets and streamlining your workflow.