Excel Charts for table with many duplicates - excel

I have a list of names with 1000 entries and maybe 750 unique. There are other attributes, like location and position. Can I create a pivot table that would show me simple stat's like X number of unique people, X number unique in location 1, location 2, location 3, and finally x number of positions in location 1, position 2/location1, position 3/location2...?
Name Location Title
Smith, Bob UK Sales Manager
Smith, Bob UK Plant Manger
Jones, Keith UK Sales Manager
Jones, Keith UK Plant Foreman
White, Derick Denver Sales Manager
Brown, Frank Boston Supply Chain
Black, Jay Denver Sales Manager
Smith, Jeff Denver Sales Manager
Gonzalez, Al UK
Gonzalez, Al UK Staging Area Manager
Bright, Susan Denver Legel Secretary
Bright, Susan Denver Paralegal
Bright, Susan Denver Executive Assistant
Bright, Susan Denver Press Secretary
Alf, Jeff Denver VP, Sales
Green, Burt Boston VP, Sales
Jones, Chuck Denver Plant Foreman
Alten, Cory Denver Sales Manager
Clark, Jerry Boston Plant Foreman
Romo, Tom Denver Sales Manager

You may want to consider using CountifS functions in adjacent columns to the data. For example to count unique people, just create a column (call it column x for this example) and enter =Countif(Column A, A1) and copy down for all the rows. then just enter =countif(Column X, 1) and that should give you the unique names.
You can use CountifS function for more complicated counting logic to answer the other questions.

I have done similar counting of unique entries using pivot tables.
I create a additional column that has a 1 if it is the first occurance of the "key" (ie name). The formula is similar to this: (assume Column A has the "key")
=IF(ROW(A1) = MATCH(A1,A:A,0),1,0)
This formula is then copied down for every row (or if it's a proper table, it's auto copied!)
The idea is that the MATCH returns the row number of the first occurrence of "key". If it is the same as the current row, then count 1. If the values aren't the same, it's a duplicate, so give it a 0 value.
When you then do a pivot table sum on this value, it adds up to the number of unique entries. (ie unique names in a region.)

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.

Formula for helper column(s) that determines singular or combined values

I am creating helper columns to assist me in reviewing our data, but I am running across an issue with one. What I am trying to accomplish is to create a helper column that tells me, by month, what type of medications a person is prescribed, and then combines multiple selections for the same name into a new name.
A sample data set would be:
A B C
1/1/2016 Doe, John Oral
1/1/2016 Doe, John Compound
1/1/2016 Doe, John Oral
2/1/2016 Smith, Jane Oral
2/1/2016 Smith, Jane Oral
2/1/2016 Adams, Tom Compound
2/1/2016 Doe, John Oral
So, for example, if John Doe was prescribed 2 oral medications and 1 compounded medication on 1/1/2016, the helper column would sort out that the three medications belong to the same person and are of two different types, so changes them to Combined. It would end up something akin to "1-Doe, John-Combined", displayed here:
D
1-Doe, John-Combined
1-Doe, John-Combined
1-Doe, John-Combined
2-Smith, Jane-Oral
2-Smith, Jane-Oral
2-Adams, Tom-Compound
2-Doe, John-Oral
So far, all I have is the concatenation by month:
=MONTH(A2)&"-"&B2&"-"
But I am not certain how to tackle the portion of the formula that will present the type of medication and combine (if required). Also, if necessary, more than one column can be created.
Thank you in advance.
Use SUMPRODUCT to test:
=MONTH(A1) & "-" & B1& "-" & IF(SUMPRODUCT((MONTH($A$1:$A$7)=MONTH(A1))*($B$1:$B$7=B1)*($C$1:$C$7<>C1))>0,"Combined",C1)

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: search two columns against another two columns to return a value fron a third

Got a bit of a pain. So got an interesting issue, basically. Have a long list of entities (200 plus) and I need to match them against a code which I have in another list. So from the entity list, I have the name and country of the entity (Name in column A, country in column D), I need to populate Column F with the code from the other list, or add unknown if a code cant be found.
So, tried to build the query by using the & operator
So =MATCH(A2&D2 to use as key, giving me a value like 'cool companyUNITED KINGDOM'.
In the second list (imported to sheet 2) contains the following columns
Code Name Country
So I want to search an array where Name and country have been combined:
=MATCH(A2&D2,Sheet2!B2:B99999&Sheet2!C2:C99999,0)
I then try to get the index back, so my complete list looks like
=INDEX(Sheet2!A2:C99999, MATCH(Sheet2!A2&Sheet2!D2,Sheet2!B2:B99999&Sheet2!C2:C99999,0))
And all I get back is #Value
Any suggestions
Edit: More infor
So sheet one looks like this (Its column C I need to populate from the code in column A, sheet two)
Entity name Status GIIN Country
Ben Dist Ltd NFFE N/a UNITED KINGDOM
Karamara Sdn Bhd PFFE N/a MALAYSIA
Farbion Trade (Curacao) N.V. LFFI N/a
Tentorim (International) B.V. LFFI N/a NETHERLANDS
Catamo B.V. TLTD N/a NETHERLANDS
Ben Dist Deutschland GmbH FLTD N/a GERMANY
Ben Dist Investments B.V. PFFE N/a NETHERLANDS
Ben Dist Limited TLTD N/a UNITED KINGDOM
Complete Solution Service Limited GLRS N/a UNITED KINGDOM
BDLT S.A. de C.V. TLTD N/a MEXICO
Telsa Telco Services SLTD N/a CHILE
And the second list will look like this
GIIN FINm CountryNm
AAAUG3.99999.SL.764 Asset Plus HSI Fund THAILAND
AABEIL.99999.SL.528 Gresham Capital CLO II B.V. NETHERLANDS
AAB36F.99999.SL.470 Maitland Malta Limited MALTA
AACRQK.99999.SL.756 BBGI GROUP SA SWITZERLAND
AADAD7.99999.SL.528 E-MAC DE 2009-I B.V. NETHERLANDS
AADDBX.99999.SL.060 GWD Limited BERMUDA
AAE9W5.99999.SL.764 Bualuang Money Market RMF THAILAND
AAGH8E.99999.SL.276 Sparda-Bank Baden-Wuerttemberg eG GERMANY
AAGR6U.99999.SL.438 Konsolidationsanstalt LIECHTENSTEIN
AAGWV3.99999.SL.360 BATAVIA PROTEKSI PRIMA 18 INDONESIA
AAGXH0.99999.SL.136 Monarch Capital Partners Ltd CAYMAN ISLANDS
AAHY1V.99999.SL.158 Pingtung County Farmers' Association TAIWAN
AAH0IZ.99999.SL.136 Diversified Absolute Return Fund CAYMAN ISLANDS
I suggest that you use following array formula:
= IFERROR(INDEX(List,SMALL(IF((INDEX(List,,2,1)=A2)*(INDEX(List,,3,1)=D2),ROW(List)-MIN(ROW(List))+1,""),1),1,1),"N/A")
To enter array formula in Windows use Ctrl+Alt+Enter.
On Mac keyboard use Command+Enter.
Then drag the formula downwards.
In this formula I have used named range List, which is equivalent to your Sheet2!$A$2:$C$99999. Named ranges make complicated formulas more readable and flexible.
If you do not want to use named ranges just replace List with Sheet2!$A$2:$C$99999.
=IFERROR(INDEX(Sheet2!$A$2:$C$99999,SMALL(IF((INDEX(Sheet2!$A$2:$C$99999,,2,1)=A2)*(INDEX(Sheet2!$A$2:$C$99999,,3,1)=D2),ROW(Sheet2!$A$2:$C$99999)-MIN(ROW(Sheet2!$A$2:$C$99999))+1,""),1),1,1),"N/A")
It works if your sheets look as follows:

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