Creating a "Features" column from 5 other metrics with true/false data - google-sheets

I have a sheet that has 5 columns, with what I will "Features" - Vegan, Non GMO, Soy Free, Dairy Free, Gluten Free.
For each product entry, I have setup simple true/false data validation based on whether that product meets the metric.
To the right, you can see a "Features" column. What I want to do is create a filter on that features column that will display products on a website based on whether any metric is meet, ie whether the product is vegan, non gmo etc
You can see what im trying to do over at VitaminSpecs. You can see the last filter currently returns "null" due to no data, but thats where I want to list "Vegan" "Non GMO" etc and allow customers to be able to multi-select those metrics
Update: From the formula provided by Player0, I am able to generate the following in the spreadsheet and on website
Spreadsheet
Filter

try in T2:
=INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE(
IF(O2:S=TRUE, O1:S1&",", )),,9^9))), ",$", ))

Related

Double (Nested) XLOOKUP with reverse search mode issue

I've created a profit/loss google sheet that allows me to price up a list of items for each project I'm working on (I've simplified it for the purpose of my issue I'm trying to solve). It works by referencing a master pricing sheet so that I can manage the current pricing from one location.
In the MasterCopy tab I'm importing the master pricing sheet for all my items. If you look at the first row, the first set of pricing for EUR, USD, AUD are my costs and the second set of those curriencies are my sell price.
https://docs.google.com/spreadsheets/d/1SE-FtDsJOblrlEpkxSwn3_L3MZ1VD6DNzTDlGTj0vCc/edit?usp=sharing
In the "Profit Loss" sheet I'm using a nested XLOOKUP formula. For columns F, G, and H the formula uses "1" for the search mode and for columns K, L, and M it is the same, but uses "-1" search mode so that it searches across the MasterCopy sheet headers in reverse.
XLOOKUP(F$2,MasterCopy!$1:$1,xlookup($A3,MasterCopy!$A:$A,MasterCopy!$1:$1000),,,1)
XLOOKUP(K$2,MasterCopy!$1:$1,xlookup($A3,MasterCopy!$A:$A,MasterCopy!$1:$1000),,,-1)
However, the issue I run into is that for some reason one of the column sets (EUR, USD, or AUD cost and sell) it will show the same pricing for the cost and sell columns for the corresponding currency. For example, cell L3 shows 1,025 USD, but the corresponding USD cost column also shows 1,025 USD, when it should actually be a value of 925 (which is correctly showing in the MasterCopy tab).
Any help would be really welcomed. I'm hoping it's a simple logic error, but just can't seem to get all the sets of pricing to show the correct values.
Edit 1
I reloaded the sheet and suddenly it's the AUD columns showing the same values. See image below
AUD columns showing same values
maybe just use the header 'AUD Sell' in Cell AR1 (MasterCopy)
AND
use this formula in Cell M3 (Profit Loss)
=XLOOKUP(M$2&" "&J$1,MasterCopy!$1:$1,xlookup($A3,MasterCopy!$A:$A,MasterCopy!$1:$1000),)
totally eliminating the search_mode which is causing this amiss.

Dropdown lists & conditional formatting in Google Sheets

I am making my business spreadsheet and my business is selling in multiple countries. So, for example, I have a drop-down list (and when Country is chosen I want it to affect the rest of the spreadsheet). In that list, I have all the countries I sell to. What I want to do is for example when I select UK it will update all the prices and costs that are there to GBP AND also hide specific columns that are not necessary for the UK. The same goes for other countries if US is selected I want to see $ currency and hide the column of VAT tax since it doesn't apply to the US.
To summarize, when Country is selected from the dropdown I want it to show different values and hide 1-2 columns. Wondering if this is even possible in sheets. Hopefully, this makes a little bit of sense. Thanks for the help!
Yes It is possible, get only the columns you want from a range.
Dropdown from a list
Go to Data > Data validation Criteria: List from range and Enter a range or formula.
The Formula
Paste this formula next to srearch key range and below the column names you want to search, Take a look at this "freshly made" Example Sheet.
=ArrayFormula(IF($B$2:$B="",,VLOOKUP($B$2:$B,$G$3:$J$16,MATCH(C$1,$G$2:$J$2,0),1)))
Choose the country and all the data will be populated, replacate this formula column and expand the lookup range to get more info put in place.
we are using MATCH to return the matching index from the column above for example Currency C1 from the range G2:J2 which is 2 in this case MATCH function returns the matching value index "column" 2, to be used as an index for vlookup function.

How to generate a distribution based bar chart on row_numbers

I have a SQL query that acts as a data source in my tableau desktop:
SELECT
row_number() over (order by sales) as rn,
article_number,
country,
SUM(sold_items) as si,
SUM(sales) as sales
FROM data.sales
WHERE sales.order_date between '2021-01-01' and '2021-12-31'
GROUP BY 2, 3
On tableau I dragged rn to column and sales to row to generate a bar chart. The following is the output:
I want to convert this into a 0-100% distribution chart so that I can get the following result:
How can I achieve this? Also, I want the user to filter by country level so even if the # of records increase or decrease, the distribution should always be consistent with the filtered data.
You can do this with nested table calcs.
For example, the following uses the Superstore sample data set, and then first computes a running total of SUM(Sales) per day, then converts that to a percent of total. Notice the edit table calc dialog box - applying two back to back calculations in this case.
The x-axis in this example is Order-Date, and in your question, the the x-axis is a percentage somehow - so its not exactly what you requested but still shows that table calcs are an easy way to do these types of operations.
Also, realize you can just connect to the sales table directly, the custom sql isn’t adding any value, and in fact can defeat query optimizations that Tableau normally makes.
The tableau help docs explains table calculations. Pay attention to the discussion on partitioning and addressing.

Google Sheets Count Unique Dates based upon a criteria in different columns

I am trying to find a formula that will give me the count of unique dates a persons' name appears in one of two different columns and/or both columns.
I have a set of data where a person's name may show up in a "driver" column or a "helper" column, multiple times over the course of one day. Throughout the day some drivers might also be helpers and some days a driver may come in for duty but only as a helper. Basically all drivers can be helpers, but not all helpers can be drivers.
I've attached a link to a sample sheet for more clarity.
https://docs.google.com/spreadsheets/d/1GqNa1hrViX4B6mkL3wWcqEsy87gmdw77DhkhIaswLyI/edit?usp=sharing
I've created a REPORTS tab with a SORT(UNIQUE(FLATTEN)) Formula to give me a list of the names that appear in the DATA Tab.
I'm looking for a way to count the unique dates a name from the name (Column A of the REPORTS Tab) appears in either of the two columns (Column B and/or C of the DATA Tab) to determine the total number of days worked so I can calculate the total number of days off over the range queried.
I've tried several iterations of countif, countunique, and countuniqueifs but cannot seem to find a way to return the correct values.
Any advice on how to make this work would be appreciated.
I think if you put this formula in cell b7 you'll be set. You can drag it down.
=Counta(Unique(filter(DATA!A:A,(DATA!C:C=A7)+(DATA!B:B=A7))))
Here's a working version of your file.
For anyone interested, Google Sheets' Filter function differs slightly from Excel's Filter function because Sheets attempts to make it easier for users to apply multiple conditions by simply separating each parameter with a comma. Example: =filter(A:A,A:A<>"",B:B<>"bad result") will provide different results between the Sheets and Excel.
Excel Filter requires users to specify multiple conditions within parenthesis and denote each criterion be flagged with an OR condition with a + else an AND condition with a multiplication sign *. While this can appear daunting and bizarre to multiply arrays that have text in it, it allows for more flexibility.
To Google's credit, if one follows the required Excel Syntax (as I did in this answer) then the functions will behave the same.
delete what you got and use:
=QUERY(QUERY(UNIQUE({DATA!A:B; DATA!A:A, DATA!C:C}),
"select Col2,count(Col1),"&D2&"-count(Col2)
where Col2 is not null
group by Col2"),
"offset 1", 0)

Query to build list of components from product list

I'm working in Google Sheets. I have a table of products to be assembled, and the number of each type of components makes them up. I'm looking to create a different sheet where I can choose the products and have it build a list of the components that are needed to build the list of products.
For example: A florist makes bouquets out of a couple different flowers. Each bouquet is entered into a table:
I'm trying to set up a formula so when I build a list of all the bouquets being made that day, it will produce a list of all the flowers needed. Something that would look like this:
Is there a way to have a query look for a certain value in a header and then pull all the values that correspond to values that are >0 in that column? Or a good work around?
Thanks alot,
With for example, a matrix that shows what flowers (F) go into which bouquet (B):
and the day's (?) bouquet requirements in Row1, a simple SUMPRODUCT formula (here in F3):
=sumproduct(B$1:E$1,B3:E3)
and copied down to suit should suffice.

Resources