Hey everyone, I need some help with my Google Sheets setup.
I’m trying to create a dynamic table that changes based on what someone picks from a dropdown menu. Here’s what I want to happen:
- I have a dropdown in cell C2 on my ‘Healthcare’ sheet.
- When someone selects ‘Healthcare’ from that dropdown, I want a specific query to run automatically.
- The query should pull data from multiple sheets and filter it.
Right now I’m thinking about putting this formula in cell A4:
=query({DataSheet1!A1:P; DataSheet2!A1:P; DataSheet3!A1:P; DataSheet4!A1:P}, "select * where Col2 contains 'Healthcare'",0)
But I only want this to execute when C2 equals ‘Healthcare’. Is there a way to wrap this in an IF statement to make it conditional? Something like:
=if(C2="Healthcare", query({DataSheet1!A1:P; DataSheet2!A1:P; DataSheet3!A1:P; DataSheet4!A1:P}, "select * where Col2 contains 'Healthcare'",0), "")
Would this approach work with just formulas or do I need to write a custom script with onEdit triggers? I’m hoping to keep it simple with just functions if possible.
Any guidance would be really appreciated!