Google Sheets - Dynamic multi-drop downs - google-sheets

Sample Data (real data can vary in # of rows):
Department Team First Name Last Name Hire Date
Sales Team SA Sara M 1/1/2020
Sales Team SA John A 1/1/2020
HR Team HA Mike S 2/1/2020
Marketing Team MA Elizabeth L 2/1/2020
Sales Team SB Rob S 1/2/2020
Sales Team SC Janet G 1/3/2020
Marketing Team MA Rob M 2/1/2020
Marketing Team MB Kenneth P 3/1/2020
Goal:
3 drop downs.
1st drop down (level 1) = Unique list of "Department" members
2nd drop down (level 2) = "All Teams" + unique list of "Team" members based on "Department" filter selection
3rd drop down (level 3) = "All Names" + unique list of "First Name"&"Last Name" (concatenated) members based on
"Department" & "Team" (all or specific) filter selection
I have never used google sheets.
What I have done is created another sheet (called "Validation")
In there, I have created three fields "All Departments" (unique(Department field)), "All Teams" (unique(Team field)), and "All Names" (unique(First Name field)) - haven't figured out how concatenation will work when querying the above table using SELECT statement.
On the third sheet, I've added 3 drop downs on the first row based on values from "Validation" sheet. However, they're independent of each others. I need them to dynamically show options (All + Choices) for the 2nd and 3rd filter).
My end goal is to show a dynamically filtered table of data from the main data sheet below the drop down row on the third sheet with some additional calculated fields. Also, if I add records to my main data table, it should automatically be included in the filter and output.

Related

Adding additional rows to data based on multiple criteria

I'm working on a project to create a template that uses one of my regular exports and changes the way the data is structured. I've attached a sample spreadsheet below.
https://docs.google.com/spreadsheets/d/1mFo_VpdeXpWkpLqMNnCBAT_93rx_JCjG508VsEwMoL4/edit?usp=sharing
The "Source Data" tab is my export, it's a list of orders where rows are repeated for each unique product that the customer has purchased. The Order Numbers are repeated for as many rows that the order has.
I'm trying to add additional row(s) to each order on my "Corrected Data" tab based on conditions and perform a calculation that would change the data that the additional row outputs.
The conditions / rules are as follows.
To add any additional rows the "Shipping Cost" of the order (column O) must be > 0
If an order has all products with a Tax Class of > 0 then 1 additional row should be added. The Order Number needs to be the same, the "Product Code" (column J) should have "TAXABLE-SHIPPING", the Product Name (column K) should be "Taxable Shipping" and the "Product Price" (column T) needs the following calculation: ROUNDDOWN((ShippingCost/(100+TaxClass)*100),2). Every other column can remain blank.
If an order has all products with a Tax Class of 0 then 1 additional row should be added. The Order Number needs to be the same, the "Product Code" (column J) should have "ZERORATED-SHIPPING", the Product Name (column L) should be "Zero Rated Shipping" and the "Product Price (column T) should be the same as the "Shipping Cost".
If the order has a mixture of Tax Classes then 2 additional rows should be added. The Order Number needs to be the same for both rows, one row should have "Zero Rated"and "ZERORATED-SHIPPING" in the Product Name/Code Columns and the other row should have "Taxable Shipping" and "TAXABLE-SHIPPING". respectively.
The "Product Price" on these two rows needs to do the following calculations and apply to their respective rows.
ZERORATED: ROUNDDOWN(((SUM(Product Prices that have 0 Tax Class)/Order Subtotal)*Shipping Cost),2)
TAXABLE: ROUNDUP(((((SUM(Product Prices that are > 0 Tax Class)/Order Subtotal)*Shipping Cost)/(100+Tax Class)*100),2)
So far, I've managed to get this working with a bit of help to the point where 1 additional row is being added when the Shipping Cost is > 0. This is only with a few select columns rather than the whole dataset. This can be seen in the "Partial Solution" tab.
I don't even know where to begin with the 2nd additional row with multiple tax classes, or how to wrap the calculations into that.
I appreciate that this one is quite lengthy and difficult, perhaps formula isn't the best solution here but I was hoping a single cell array formula would be able to do this. Any help at all pointing me in the right direction would be hugely appreciated! <3

Querying, Ordering, and Selecting from a Row by String Value Across Sheets

I have a Google Sheet file called Shipments that contains shipments delivered to different warehouses, with fields Delivery Date - Company Name - Shipment Type, and I have a sheet called Companies which has a columns Company Name - Membership Status - Rating. All of these values are pulled automatically from a different GSheet, they are not entered manually, so row orders change.
I want to pull the last shipment delivered for a company in the Shipments sheet into a "Last Delivery Date" field in the Companies sheet, so the Companies sheet has the following columns:
Company Name - Membership Status - Rating - Last Delivery
I think I have to do a query or a named range that is something along the lines of SELECT ONE Delivery Date WHERE B (column for company name in Shipments) === A (column for company name in Companies) ORDER BY (last delivery date column) DESCENDING
Not sure how to accomplish this in GSheets, am exploring queries now. Any help greatly appreciated!
You can use this in Companies!D1:
={
"Last Delivery";
ARRAYFORMULA(
IFNA(VLOOKUP(
Companies!A2:A,
SORT({Shipments!B2:B, Shipments!A2:A}, 2, FALSE),
2,
0
))
)
}
Assuming Company Name is in Companies!A:A and in Shipments!B:B, Delivery Date is in Shipments!A:A.
Maybe there is a more elegant solution that uses QUERY. Could not come up with one on the spot.

Sort Range Ignoring "" Flavor of Blank on Google Sheets

I have a spreadsheet with 2 main columns.
Column A is the student's name.
Column B is the student's grade.
Other columns (not shown) list various information about the student that the end users input.
End users click on the Data Validation Arrow to select the student in Column A, and the student's grade is auto populated in Column B.
The formula in Column B is:
=IF(A2="","",Index(All!$B:$B,Match(A2,All!$A:$A,0)))
The All sheet contains a master directory of the Students and their Grade level assignment.
The Problem:
When users attempt to re-sort the data using the Sort A-Z menu option in B1, it includes the blank cells in the sort - The blank cells come first, moving all the relevant data to the bottom of the sheet.
I understand that G-Sheets considers "" to be text. Is there another method to write my formula that would keep the Grade column blank, but allow for the sorting feature to function as end users would expect?
You can implement two additional comments where you filter the results before sorting them:
=SORT(FILTER(A2:B,not(B2:B="")),2, true)

Google sheets, repeated text

I'm creating a google sheet document for organising a tournament.
I'll leave here the sheet so you can see https://docs.google.com/spreadsheets/d/1ov0Zme0jgLEnvuV1tFH577iNe1TzwmPgf6iOuECPdmc/edit?usp=sharing
I would like to have another table with two columns.
Team name | Number of apparitions
That way I can see if a team is complete or not. The team name column is the column called Equipo.
Anyone can help with this?
I already did it on two steps.
I used =UNIQUE(F:F) on H column (F is the column with the team names) for the Team Name column
I used =COUNTIF(F:F; H14) where H14 is the team name to search (obtained on the previous step) for the number of apparition of that name in F column

EXCEL - Sub Total Function

I know how to use Subtotal when I only need a breakdown by 1 column. But I have a sheet with 2 sort level. I need to get counts based on values for each of the second level sort. To clarify, I need something like this: assuming Col A is primary sort and Col B is secondary.
A B Count
Walmart Shoes 20
----------
Walmart Socks 10
Walmart Shirts 25
Target Socks 50
Target Jeans 5
Target Shirts 10
etc... (Not sure how to make this prettier(more readable).
Can the Subtotal function do this or do I have to get into Pivot Tables (Group, etc)? Thanks in advance?
Seems like this would be a situation that would call for a Pivot Table.
To create the pivot table select one of the cells in the raw data (Columns A through C in the picture). Then select the Insert Tab >> PivotTable >> PivotTable. You'll have the choice of putting the PivotTable on another worksheet or the one that contains the data (as shown).
Check A, B and C as seen in the picture, the choice of area should be done automatically, however if one of them does not automatically appear in the correct area (as shown) you can drag it.
Under PivotTable Tools select the Design tab and then Report Layout and Show in Tabular Form.
To the left of Report Layout is Grand Totals which you would turn off to make the pivot table look more like the table in your example.
To the right of Grand Totals is Subtotals which you would also turn off by choosing Do not show.
If it is important that Walmart precede Target, select the down arrow in PivotTable cell containing A (E2 in the picture), and sort Z to A.
Hope this helps.

Resources