Flag duplicate relationship in excel - excel

I have data available in excel as given below:
Below is the criteria for the expected column:
Duplicate relationship should be color coded/flagged.
I have added expected result in a column G Is duplicated?.
To achieve that I have tried using Match function of excel, but it doesn't match my requirement.
Please suggest what should be the correct approach to fix this.

You can create a sorted csv of each of the words on each row:
=TEXTJOIN(",",FALSE,SORT($A3:$D3,1,1,TRUE))
name
relation
name
relation
sorted_csv
Milly
Wife
Jack
Husband
Husband,Jack,Milly,Wife
Jack
Husband
Milly
Wife
Husband,Jack,Milly,Wife
Reacher
Son
Jack
Father
Father,Jack,Reacher,Son
Reacher
Son
Jack
Mother
Jack,Mother,Reacher,Son
Then you can count the rows by sorted_csv:
=COUNTIF($E$3:$E$6,$E3)
name
relation
name
relation
sorted_csv
count by sorted_csv
Milly
Wife
Jack
Husband
Husband,Jack,Milly,Wife
2
Jack
Husband
Milly
Wife
Husband,Jack,Milly,Wife
2
Reacher
Son
Jack
Father
Father,Jack,Reacher,Son
1
Reacher
Son
Jack
Mother
Jack,Mother,Reacher,Son
1
Any row that has a count greater than 1 is a duplicate of another row.

Related

GSuite App Maker - how to pivot datasources

I have a simple app that takes attendance for a list of students. There are two datasources, a students table with first name, last name, id, and site, and an attendance table with first name, last name, date and present.
I want to be able to log attendance by getting a list of the students, entering a date, and check a box if they're in attendance or not (boolean column).
What I would like to do is pivot the attendance date for a new view so that instead of having a column with distinct dates, I'll have a columns for each date showing the value of the checkbox.
Ex:
Attendance 1:
First Last Date Present
Bob Smith 10/1 0
Bob Smith 10/2 1
Bob Smith 10/3 1
Kevin Brown 10/1 1
Kevin Brown 10/2 1
Kevin Brown 10/3 1
New Pivoted View:
First Last 10/1 10/2 10/3
Bob Smith 0 1 1
Kevin Brown 1 1 1
Is there a simple way to get this result in App Maker?
EDIT: For clarification. The primary purpose of the app is to capture attendance data in a classroom setting. So there is a flow where a teacher pre-populates a list of students and then checks the boxes down the line to log where a student was present/absent.
What I would like to be able to do is provide a page that presents the attendance data in a wide format so teachers can also look across the columns to see who was there on a given day.

How to find row with specific column value only

I am trying to figure out the names who only have specific column value and nothing else.
I have tried filtering the rows according to the column value but that isn't what I want, I want the names who only went to eat pizza.
I want names who only had pizza, so my code should return John only and not peter as john only had pizza
Click to view data frame
Your description is not clear. At first, it looks like a simple .loc will be enough. However, after viewing your picture of sample data, I realized it is not that simple. To get what you want, you need to identify duplicated or non-duplicated names having one Restaurant value only, and pick it. To do this, you need to use nunique and check it eq(1), and assign it a mask m. Finally, using m with slicing to get your desire output:
Your sample data:
In [512]: df
Out[512]:
Name Restaurant
0 john pizza
1 peter kfc
2 john pizza
3 peter pizza
4 peter kfc
5 peter pizza
6 john pizza
m = df.groupby('Name').Restaurant.transform('nunique').eq(1)
df[m]
Out[513]:
Name Res
0 john pizza
2 john pizza
6 john pizza
If you want to show only one row, just chain additional .drop_duplicates
df[m].drop_duplicates()
Out[515]:
Name Restaurant
0 john pizza

Excel find duplicates in two tables and display related data

Let's say I've got two tables with two columns. In both cases, the first column consists of a name and a second column consist string of characters with the similar pattern. It looks like this:
Table 1
Peter xxxxx01
John xxxxx01
Bill xxxxx01
William xxxxx01
Table 2
Richard xxxxx02
John xxxxx02
Bill xxxxx02
Arthur xxxxx02
Now, I'd like to compare these two tables, find values where the names are duplicated and display data stored in second columns, just like this:
(Peter excluded)
John xxxxx01 xxxxx02
Bill xxxxx01 xxxxx02
(William, Arthur excluded)
I am familiar with pivot tables, however, it won't allow doing this.
I've also tried messing with index match formulas but without much success.
Any advices?
You can use the VLOOKUP function for this.
If your "Table1" is in B3:C6, and your "Table 2" is in F3:G6, then you can use the following formula in D3:D6 to lookup the values in table 2;
Cell D3: =IFERROR(VLOOKUP(B3,$F$3:$G$6,2,FALSE),"")
This is first looking up the name in table 1 (Cell B3) against table 2 (F3:G6), and returning the second column of table 2 if it finds the name. If it doesn't find the name, it will return an error, so we wrap the VLOOKUP in an "IFERROR" function, and replace any errors with an empty string, so it looks a bit friendlier. This results in the following table;
A B C D E F G
1
2 Table 1 Result Table 2
3 Peter xxxxxx01 Richard xxxxxx02
4 John xxxxxx01 xxxxxx02 John xxxxxx02
5 Bill xxxxxx01 xxxxxx02 Bill xxxxxx02
6 William xxxxxx01 Arthur xxxxxx02
You can then filter on the (Non-Blanks) in column D to only get the results you're interested in.

Extract list in excel based on criteria

I have a list of names and a list of categories in a table.
Example:
Name Category 1 Category 2 Category 3
Jane Doe X X
Bill Smith X X
Eric Hamilton X
From that list, I want to list the people for each category.
Example:
Category 1 Category 2 Category 3
Jane Doe Jane Doe Bill Smith
Bill Smith Eric Hamilton
Is there a way I can do this in excel?
I found this video which seems to accomplish what I want. The formula is a bit more complicated than what I was hoping for, but it worked. I just removed some of the absolute cell references and copied the formula for the number of categories I currently have and it grouped the users properly.
https://www.youtube.com/watch?v=QkHfZtvC7UQ

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