Thank you in advance. I’m very new to this type of programming (using query).
I have a spreadsheet where I’m storing a whole bunch of product data. Right now, it’s 30+ columns and 150 rows. What I’d like to do is to be able to filter the data so that I only am looking at the information that I want to and make the rest disappear.
I’d like to use dropdown menus to be able to select the portions of the data that I’d like to view. Some of the dropdown menus are showing/hiding select columns and I’ve been able to get these to work.
I’m having trouble combining this with the filtering out some of the rows.
https://docs.google.com/spreadsheets/d/1XSvKrCtOfDNTDKAzeEVKa-EEoByiyAQh37aVgO9Fc78/edit?usp=sharing
=QUERY(‘Master Data’!A2:AD, “SELECT Col1, Col2″ &IF(A2=”Yes”, “, Col3″,””) &if(B2=”All”, “, Col5”, “”)
&if(D2=”Show Metric”,”, Col9, Col10, Col11, Col12″, “”) &if(D2=”Show Imperial”, “, Col13, Col14, Col15, Col16”, “”)
&if(E2=”Show Metric”,”, Col17, Col18, Col19, Col20, Col21″,””) &if(E2=”Show Imperial”,”, Col17, Col22, Col23, Col24, Col25″, “”) &if(F2=”Show”, “, Col26, Col27, Col28, Col29, Col30”, “”) &” WHERE 1=1″,2)
Above is the formula that I’ve written so far and it’s working to be able to show/hide the sets of columns that I want.
The end is where I’m trying to add a modification &” WHERE 1=1″
What I had tried to do is replace it with:
&if(B2=”ALL”, ” WHERE 1 = 1″, ” WHERE E = ‘”&B2″‘”)
This doesn’t work! Ultimately, I’ll be looking to have at least two cells that will modify the WHERE clause and I’m not sure if this is going to cause me trouble. Any guidance would be really appreciated.
Kevin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.