Multiple Unique Lists from Master List in Excel - excel

I have a list of companies with multiple contacts for each company, but I would like to create separate lists with 1 unique contact per company. E.g.
Original list
Name Company Email
John AAA john#aaa.com
David AAA david#aaa.com
Jane BBB jane#bbb.com
Julia CCC julia#ccc.com
Craigh CCC craig#ccc.com
John CCC john#ccc.com
In this case, to have 1 unique record from each company in a separate list, I want to end up with 3 separate lists:
List 1
Name Company Email
John AAA john#aaa.com
Jane BBB jane#bbb.com
Julia CCC julia#ccc.com
List 2
Name Company Email
David AAA david#aaa.com
Craigh CCC craig#ccc.com
List 3
Name Company Email
John CCC john#ccc.com
As you can see in each list there is only 1 record for each company.
Any help on how to do this would be most appreciated.
I have tried advance filter to list unique records only by selecting the entire original list as the range and setting the company column as the criteria see the unique records which I could then select visible cells and cut to a different list, and then re-run the filter again to create the next set of unique records etc...but the advance filter doesn't give the results as expected.
-
-

This might be a silly idea but still worth trying... Add a helper column with Count formula:
=COUNTIF($B$1:B2,B2)
Apply Filter and Sort your data set by the fourth column (Sort Smallest to Largest):
This seems to match your Table 1, 2 & 3 output.
Alternatively, if you still want to create separate tables, you can use the helper column and array formulas (Ctrl+Shift+Enter) as per example below:
=IFERROR(INDEX($A$1:$C$7,SMALL(IF($D$1:$D$7=1,ROW($D$1:$D$7)),ROW()-1),COLUMN()-5),"")
Change $D$1:$D$7=1 to =2 and =3 to replicate the 2nd and the 3rd table.
Edit: with additional "Location" column
=COUNTIFS($B$1:B2,B2,$D$1:D2,D2)

Related

I'm looking for an excel formula to get a count of unique client ID's when a condition in another column are all met

I have a data set that looks like this:
Date
Client ID
Successful outcome (y/n)
1/1/21
AAA
Y
1/2/21
AAA
N
1/3/21
AAA
N
1/1/21
BBB
N
1/2/21
BBB
N
1/2/21
CCC
N
1/3/21
CCC
N
1/4/21
CCC
N
1/1/21
DDD
Y
1/4/21
DDD
Y
I need to find a unique count where all records for a client was No. If at any point, an outcome was yes, then that unique client ID would not be included in the count.
I tried using variations of different formulas I found online:
=SUM(--(LEN(UNIQUE(FILTER('Table[Client ID],'Table[Successful Outcome (y/n)]="No")))>0))
=COUNT(UNIQUE(FILTER('Table[Client ID],'Table[Successful Outcome (y/n)]="No")))
However I'm not able to get the count to exclude a client ID entirely if there is a "yes" for that client. In the sample above, Client A should not be included in the unique count because there is a "Yes" value.
I ended going brute force where I sorted the table by Client ID, highlighted duplicates, and then deleted all the client records when there was a yes and a no.
What I was left with was a table of duplicate client records where all successful outcomes were No, along with the other non-duplicate records of Yes's and No's. I then filtered for No's and from there I deleted the duplicates in the Client ID column.
Use Let and another FILTER and MATCH to remove the ones that have a Y:
=LET(x,FILTER(Table[Client ID],(Table[Successful outcome (y/n)]="N")*(ISERROR(MATCH(Table[Client ID],FILTER(Table[Client ID],Table[Successful outcome (y/n)]="y",""),0))),""),IF(#x="",0,COUNTA(UNIQUE(x))))
=COUNTA(UNIQUE(IF(ISNUMBER(MATCH(B2:B11,FILTER(B2:B11,C2:C11="Y"),)),"",B2:B11&"")))-1

Multiple Vlookup for identifying a customers name or business

I want to create a multiple vlookup to match records on an ID from two sheets. If the column reference does not exist I want it to look at a different column.
This is what I have already:
=IF(VLOOKUP(A2,'Roots data'!F$2:Y$1139,18,0)>0,VLOOKUP(A2,'Roots data'!
F$2:Y$1139,17,0))
18 being the column which I want to check first and 17 being the column I want to check second. Can you please advise why this is not working appropriately?
Sample data:
Table 1:
ID First Name Last Name Age/Road
1 James John
2 John Miller
Table 2:
ID Age Address
1 21 1 Road
2 22 2 Road
In this example, if I wanted to find the Age of ID 1 which is James I would do a vlookup to identify this, if the age was not present I instead would want to know the address for ID 1, to be populated under Age/Road in Table 1.
I believe this is what you are looking for:
=IF((VLOOKUP(A2,'Roots data'!F$2:Y$1139,18,FALSE)=0),VLOOKUP(A2,'Roots data'!F$2:Y$1139,17,FALSE), VLOOKUP(A2,'Roots data'!F$2:Y$1139,18,FALSE))

Excel column compare and match

I have a report which shows the ID#s and the names corresponding to those IDs.
I am trying to write a formula which check the ID# and see if the same ID#s have the same Name;
If the same ID #s are listed more then once and they have different names then it should show that the IDs and names do not match.
The idea is that same ID#s should have the same name; if the same IDs have different names then it should show that ID have different names.
Col A Col B Col C
ID Name Desired Output
3 Peter ID with multiple names
3 Ken ID with multiple names
5 Chris match
5 Chris match
5 Chris match
6 Dave match
6 Dave match
7 Lisa match
8 Mark match
10 Ken match
12 Frank ID with Multiple names
12 Randy ID with Multiple names
12 Frank ID with Multiple names
12 Mike ID with Multiple names
Use COUNTIFS():
=IF(COUNTIFS(A:A,A2,B:B,"<>" &B2),"ID with multiple names","match")

I need to find a way to show the number of relationships between values in two different excel columns

OK, I have two columns in excel that contain city names. I need a rank of how many times a relationship between two cities occurs. For example, the ranking for the data below should be as follows. #1 is Austin to Dallas with 3 occurrences. #2 is Chicago to Boston with 2 occurrences. #3 is Chicago to New York with 1 occurrence.
sample data set
You can use a =COUNTIFS statement to check specific cities.
For example:
Row 1 = Headers
Column A = Origin City
Column B = Destination City
Data in your table should be in A2:B7
You can use:
=COUNTIFS($A$2:$A$7,"Austin",$B$2:$B$7,"Dallas")
=COUNTIFS($A$2:$A$7,"Chicago",$B$2:$B$7,"Boston")
=COUNTIFS($A$2:$A$7,"Chicago",$B$2:$B$7,"New York")

Combining like data on a spreadsheet

I'm not sure how I would go about creating a macro (or maybe even an Access query?) for what I'm looking at here. I have a spreadsheet of tens of thousands of customer names/numbers with product data. If a customer has bought two (or more) products, it reflects as multiple entries on the spreadsheet (example below).
Name # Product
----------------------------
Bob 101 Product 1
Joe 102 Product 3
Bob 101 Product 2
Bob 101 Product 3
Hank 103 Product 2
Susan 104 Product 1
Hank 103 Product 3
I want to run something on that spreadsheet that combines the entries into one line, such as the example below. I'm not concerned about how the "products" are delineated... comma, line break, space, whatever. But I would like the end result to look something like this
Name # Products
-----------------------------------------------
Bob 101 Product 1, Product 2, Product 3
Joe 102 Product 3
Hank 103 Product 2, Product 3
Susan 104 Product 1
But I'm not even sure where to start. Any ideas to at least get me in the right direction?
Sort on Product within Name and in D2 (?):
=IF(A1=A2,D1&", "&C2,C2)
in E2:
=A2<>A3.
Copy both down, select all, Copy, Paste Special, Values over the top, filter to select FALSE for ColumnE and delete all visible.

Resources