Identifying repeat interaction from two columns - interaction

I have two columns which contain investment bank names in joint debt offerings. I want to create a dummy variable if the Bank 1 & Bank 2 have recurring relationships.
Ex: if Lehman Brothers & Goldman Sachs or Goldman Sachs & Lehman Brothers appear in column 2 & 3, Dummy = 1
Can anyone suggest a method to calculate this relationship?

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

How to split a master sheet of email addresses

Ok so the need - I have about 3700 lines of email addresses, names, schools, and professions(those are column headers) I want to split this sheet into 4 with 1000 lines(I understand one will be short) in each but here is the catch I can only have 25 lines/emails from each school. So how would someone go about doing this? Keep in mind each sheet needs to have its own unique emails not repeated on the other sheets.
There are 2 problems here and as I don't know how many schools are on the list and if it's possible to have always less than 25 people from one school (for example - if there are only 30 schools, it would be impossible to distribute them in 1000 row batches).
First task:
Distribute database into 4 sheets, 1000 rows each:
It's simple.
Let's say my data has 4 columns from A to D
I make sheets named 1-1000, 1001-2000, etc.
In each one I put a formula:
1)
=query(Master!A1:D,"select * limit 1000 offset 0")
=query(Master!A1:D,"select * limit 1000 offset 1000")
=query(Master!A1:D,"select * limit 1000 offset 2000")
=query(Master!A1:D,"select * limit 1000 offset 3000")
Etc.
In order to limit number of occurences of each schools, I have to count these occurences and define what is the minimal page number on which this student can be displayed (for example - 17th student from certain school can be on 1st page, but 27th can be at least on 2nd page. 60th student can be on third or further.
When I determine minimal page number, I can sort my data accordingly and display sorted by minimal number:
In this situation my query on next pages have additional parameters:
=query(Master!A1:G,"select A,B,C,D order by G limit 1000 offset 0")
I use column G for sorting, but I don't display it.
You can find my solution here:
https://docs.google.com/spreadsheets/d/1TP6MlMmLiUExOELFhgZnti7LR7VQouMg3h-X7QRcHzQ/copy
Names are generated randomly from polish names generator.

How To Combine 2 COUNTUNIQUEIFS - If This AND That

I have three columns; Customer Name, Active License, Account Connected -
Customer Name
Active License
Account Connected
Alex
Yes
Yes
Barry
Yes
No
Alex
No
No
Claire
No
No
Alex
No
No
Deborah
No
No
I am using this formula to count the number of unique customers that have at least 1 active license: =COUNTUNIQUEIFS(A2:A,B2:B,"Yes") and the same to count the number of customers with at least 1 account connected. =COUNTUNIQUEIFS(A2:A,C2:C,"Yes")
How can I combine the two formulas to count the number of unique customers who have at least one active license AND at least one account connected. And how can I do it in the negative; counting the number of unique customers who have at least one active license but *don't have any connected accounts.
Thanks a lot :)
Use "basic" is correct in his comment to your original post that the following will give you the unique count of "Yes/Yes":
=COUNTUNIQUEIFS(A2:A,B2:B,"Yes",C2:C,"Yes")
However, his second suggestion will not produce the "Yes... without any second Yes'es." This is because some users with a "Yes/Yes" may also have entries with "Yes/No"; but they should not be counted since they do have at least one "Yes/Yes".
Instead, you'd use the count of all "Yes/?" and subtract those with any "Yes/Yes":
=COUNTUNIQUEIFS(A2:A,B2:B,"Yes") - COUNTUNIQUEIFS(A2:A,B2:B,"Yes",C2:C,"Yes")
If you already have a cell containing the "Yes/Yes" count somewhere (say, D2), you can just sub that into the formula:
=COUNTUNIQUEIFS(A2:A,B2:B,"Yes") - D2
And if you have both the "Yes/?" count in a cell (say, C2) and the "Yes/Yes" count in a cell (say, D2), you can reduce to just the cell references:
=C2 - D2
This seems like it was more of a logic question than a Sheets question, per se. But there's my take on it.

Google Sheets - Dynamic multi-drop downs

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.

Multiple criteria in a filter/summation combined, entered into two columns for sorting

I have a spreadsheet that tallies sales over time, including sales person, office they work out of, and the price of whatever it is that they sold. I am attempting to create a two-column filtered list by multiple criteria. The data looks like this:
Date Name Office Price
5/5/12 Joe OW 220000
6/1/12 Jim SOL 100000
What I want to be able to do is create a two-column entry that sums the price column, but uses multiple critera from the first three to do so. For instance, "everyone named Jim who sold something in May", and then I'd like to sort that by the top three.
Using items like:
=FILTER( C1:C ; D1:D="OW"; month(B1:B)=month("5/12/12"))
and
=ARRAYFORMULA(frequency(MATCH(E1:E&counta(E1:E),UNIQUE(E1:E&counta(E1:E)),0), MATCH(UNIQUE(E1:E&counta(E1:E)),UNIQUE(E1:E&counta(E1:E)),0)))
I can filter and tally, but I am unable to replace the frequency mentioned above with a summation of the price column.
Rather than using FILTER you could put together something using SUMPRODUCT:
=arrayformula(sumproduct($E$2:$E$3*($C$2:$C$3=C2)))
If you have column E as price and column C as name, this creates a new column that shows the total earnings for each name, next to every instance where that name appears in the array. You can apply further conditions within the SUMPRODUCT call as needed. You could then apply UNIQUE to deduplicate and sort the resulting table to see the top 3.

Resources