I've been trying to build a small database with Google Sheets for me, my wife, my friend and his partner, to make it quick and easy to search through our recipes from HelloFresh!
I've input all of the recipes, and I am able to query to show recipes we would like based on which meat/vegetable, and what main ingredient (pasta, rice etc).
The next thing I would like to do is have a list generate/filter based on what ingredients we have, in this case cells J6:J13. I would like the list to generate if any criteria is met. For example, if both Chicken Thigh and Beef Mince are selected, it will show all recipes that have chicken OR beef.
Would anyone be able to assist, please?
https://docs.google.com/spreadsheets/d/19Nrr5NurZ5SkLYYPg09dl_XJMe2gx7Ft2TFO4yNklKY/edit?usp=sharing
try:
=INDEX(IFERROR(UNIQUE(QUERY({Horizontal!B2:B,
FLATTEN(QUERY(TRANSPOSE(Horizontal!C2:P),,9^9))},
"select Col1 where 1=1 and "&
TEXTJOIN(" or ", 1, IF((J6:J15="")+(J6:J15="-"),,
"Col2 contains '"&J6:J15&"'")))), "no selection"))
Related
I have a list of email addresses in one sheet (first column).
I have a list of transactions in another sheet with emails and sale amounts.
I am looking for a formula that adds up all the transaction $ sales for any transactions made by the people (emails) in the first sheet.
Any help would be much appreciated!
Your sample data is very limited (only one row matching one person, in fact). But the following formula should work for you. Place it in a new sheet, in cell A1:
=ArrayFormula(IFERROR({"Name","Total"; QUERY(FILTER(Transactions!A2:D,NOT(ISERROR(VLOOKUP(Transactions!A2:A,Tags!A:A,1,FALSE)))),"Select Col2, SUM(Col4) GROUP BY Col2 ORDER BY Col2 LABEL SUM(Col4) '' ")},"No Data"))
This one formula will produce the headers (which you can change within the formula itself as desired) and all results.
FILTER filters in only 'Transactions' data (names through amounts) where the emails are found in the 'Tags' sheet.
Then QUERY returns the name and totals for each match in alphabetical order by name.
If there are no matches, "No Data" will show instead.
If I understood your question correctly!
Try this on the sheet, where you only have emails and wanted to get sum of sales amount
=sumifs(range_whichHasTransaction , range_of_Email_inThat_TransactionsTable , Cell_Reference_ofEmail_forWhich_you_want_sum_the_Transaction_Amount)
it will Look something like this:-
sumifs(TransactionSheet!B:B,TransactionSheet!A:A,Emails!A2)
Reference
SUMIFS
I have a much larger version of the following tables across two sheets (Cat1, Cat2, respectively)
screengrab
I'd like to get to an output like the following:
City
Category
Boston
Tea
Boston
Beer
Boston
Burger
Where when the matrix = Ready, it shows me city and the category that is ready. I've never used query before, and what I have tried hasn't worked, but this seems like the right tool for the job. Any help is appreciated, TIA!
Try this in cell A1 on a new sheet (delete everything below):
=arrayformula({"City","Category";query(split(flatten({'Cat1'!A2:A&char(9999)&if('Cat1'!B2:D="Ready",'Cat1'!B1:D1,);'Cat2'!A2:A&char(9999)&if('Cat2'!B2:D="Ready",'Cat2'!B1:D1,)}),char(9999)),"where Col2 is not null order by Col1,Col2",0)})
With 12 columns:
=arrayformula({"City","Category";query(split(flatten({'Cat1'!A2:A&char(9999)&if('Cat1'!B2:M="Ready",'Cat1'!B1:M1,);'Cat2'!A2:A&char(9999)&if('Cat2'!B2:M="Ready",'Cat2'!B1:M1,)}),char(9999)),"where Col2 is not null order by Col1,Col2",0)})
I just started using google sheets to help edit tables for a database and I need some help creating a function. In ColumnA, I've got a list of MovieID's, in ColumnB, there is a list of directors, and in ColumnC, there is a list of unique directors from ColumnB. I'm trying to filter the data and create a set of columns where in one, there is the director's name and in the other, there's the movieID that corresponds to a film the director was involved in.
Ive created a function in F2 to find the ids for a director, and I can just drag the formula down (when the data is transposed, and the C2 value will shift to C3, C4....) But, I want the name of the director to be included in the column to the left of the filtered results (like I've manually done in E), but I can't really figure it out, and I'm not entirely sure on how to use the other functions to get it right.
Any help or guidance on how to achieve this would be greatly appreciated!!
Looks like this will solve your issue
=INDEX(QUERY(SPLIT(FLATTEN(
SPLIT(B2:B,", ",0)&"#"&A2:A),"#"),
" where Col2 is not null order by Col1 "))
If on the other hand there is only one name in cell E2 use
=QUERY(ArrayFormula(IFERROR(SPLIT(IF(REGEXMATCH(B2:B,E2),C2&"-"&A2:A,),"-"))),
"where Col1 is not null",0)
I need to make a list of which student is taking what kind of exam on which date and time.
The sheet with all the data looks like this:
This is per student but not per date.
I would like to have a tab per exam AND time. So exam Dutch is taken at 06-06-2019 at 10:00h, 12:00h and 14:00h. Tabs should be like: tab1 all students that take exam Dutch at 06-06-2019 10h, tab2 all students that take exam Dutch at 06-06-2019 12h, etc.
The order of columns can't change because the sheet as in the example is also generated with formulas etc. from other sheets.
I tried the VLOOKUP formula but this can't search on the left. I have absolutely no idea how to solve this.
I'm not looking for a ready to use answer. Just push me in the right direction.
You could use filter() or query().
Assuming 'achternaam' in column A and 'exam Dutch' is in column E, you can try
=query('SheetwithData'!A:E, "Select A where E contains '06-06-2019 10:00'", 1)
Replace the sheet name with the actual sheet name.
I would like to perform a multi criteria search of data in a column- contains data of check boxes(more than one option chosen).
For a clearer picture of what I am trying to do, screenshot below is a question in a form
Data from the form are saved in sheets like below,
So my concern here is if I would like to search/filter for the rows that contain "Commercial", the rows with Commercial,Engineering doesn't show up. That's definitely not an effective search.
Any advise on how can I go about this issue is kindly appreciated. If
Let's say you have your form in the response sheet in columns A to P, with the multiple choice in col D. If you want to filter your data on the word 'Commercial' you can either do:
=filter(A2:P, regexmatch(A2:P, "Commercial"))
or use query():
=query(A2:P, "select * where B contains 'Commercial' ")
Note: depending on your locale you may have to change the commas to semi-colons in order for the formulas to work.
I hope that helps ?
Following JPV's answer, I developed a line to make the query useful if you want to cross two categories. Let's suppose that someone in your checkbox example had picked all the options (IT, HR, Commercial, Engineering); and that you have created the cell with the dropdown option box in cell B1 with all your options, as JPV said.
Then, you want to filter and see all the people who had chosen IT and Commercial. You would, for that, create a second cell with the dropdown option box in, lets say C1; and then your query would be:
=query(A2:P, "select * where B contains '"&B1&"' and B contains '"&C1&"' ")
=FILTER(MOBILE!A2:E2000, ISNUMBER(SEARCH(A1,MOBILE!A2:A2000)))
SEARCH function will return a number of the position of the searched word (A1) in the searched strings in range (MOBILE!A2:A2000).
If the result of search is a number (ISNUMBER), then filter will return the TRUE rows result from the range MOBILE!A2:E2000.