Excel column compare and match - excel

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")

Related

Multiple Unique Lists from Master List in 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)

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 - return all unique permutations of 3 columns

I have 3 columns
a b c
jon ben 2
ben jon 2
roy jack 1
jack roy 1
I'm trying to retrieve all unique permutations e.g. ben and jon = jon and ben so they should only appear once. Expected output:
a b c
jon ben 2
roy jack 1
Any ideas of a function that could do this? The order in the output does not matter. I've tried concatenating and then removing duplicates, but obviously this only considers the string order.
I've created a fourth column by joining all three columns together =a1&","&b1&","&c1 and used excel's built in remove duplicates function. This doesnt work as the order of the strings are different.
In your forth column use the formula
=if(A1<B1,A1&","&B1&","&C1,B1&","&A1&","&C1)
Which should join A and B in alphabetical order, then you can remove duplicates as you have done.

Marking Duplicate Values based on additional cell.

I am looking for a way, preferable formula based, to mark if a value(name) is present in a spreadsheet more than one time based on a difference in the order# in a different column. As there are multiple lines per order some names will have the same order# on multiple lines but I do not want to mark those only if there are multiple order#s for a person. Example below (new so might not be best formatting for site, sorry.) Thanks
ORDER# LN QTY ITEM LOC NAME DUPLICATE
OD10560 1 24 part#12 Location 1 Joe John Marked
OD10559 1 1 part#114 Location 2 Bunny Johnson Marked
OD10569 1 3 part#444 Location 1 Joe John Marked
OD10567 1 3 part#777 Location 2 Archy Bunker
OD10567 2 4 part#123 Location 2 Archy Bunker
OD10562 1 24 part#458 Location 1 Kay Harrison
OD10577 1 2 part#471 Location 2 Bunny Johnson Marked
OD10577 2 1 part#736 Location 2 Bunny Johnson Marked
OD10563 1 2 part#778 Location 1 Mark Riddle
OD10579 1 2 part#3347 Location 1 Terry Clark
COUNTIFS will allow you to see how many orders a person has, not including the current one.
The formula for MARKED would be:
=COUNTIFS($F$2:$F$11,F2,$A$2:$A$11,"<>"&A2)
in G2, and drag down.
This will count the lines where the person has the same name, but a different order. You can simply mark those that are greater than 0.
Note that this will show the second line as 2, as Bunny Johnson has 2 lines with different orders (it counts both of the other lines, as they have different order numbers, even though both of those lines have the same order). This does not alter the result in any way, just explaining why it shows 2 instead of 1 for everyone else
You could use the =COUNTIF(range, criteria) and just see if there are more than 1 counted.
Its pretty simple if you just take all of your names as the range and criteria is your name on the line you are looking at

Excel - Counting unique records in a group

I'm having difficulty counting records in a file that have a unique ID and listing the number of rows associated with that specific ID.
For this file, the unique ID represents a specific family (column A). Each member of the family is in a different row with the same ID. I would like to count the number of family members(rows) in each unique family. I can have a few thousand rows so automating this would be wonderful. Thanks for any help!!
You can do this now automatically with Excel 2013.
If you have that version, then select your data to create a pivot table, and when you create your table, make sure the option 'Add this data to the Data Model' tickbox is check (see below).
Then, when your pivot table opens, create your rows, columns and values normally. Then click the field you want to calculate the distinct count of and edit the Field Value Settings:
Finally, scroll down to the very last option and choose 'Distinct Count.'
This should update your pivot table values to show the data you're looking for.
So if I'm understanding you correctly, you have something like
A B C
Fam. ID LastName FirstName
1 Smith John
1 Smith Mary
1 Smith Johnnie Jr
2 Roe Rick
3 Doe Jane
3 Doe Sam
and you want a new column (say, D), with a count of members per family:
A B C D
Fam. ID LastName FirstName Fam. Cnt
1 Smith John 3
1 Smith Mary 3
1 Smith Johnnie Jr 3
2 Roe Rick 1
3 Doe Jane 2
3 Doe Sam 2
This will do it -- insert at D2 and drag down:
=COUNTIF(A:A,A2)

Resources