Excel pivot table that counts non-numeric data? - excel

I'm helping a coworker with a problem and I've run into a bit of a wall myself. He receives a CSV file from a survey of student responses after a set of classes are completed, and he wants to generate reports showing the number of responses in each category in each question (i.e. # Agree, # Strongly Agree, etc).
The CSV file has a format similar to this:
DateTime School Class Question 1 Question 2 Question 3 ... etc ...
======== ====== ===== ========== ========== ==========
1/1/2012 A 1 Agree Strongly Agree Disagree
1/1/2012 A 1 Disagree Agree Strongly Disagree
1/1/2012 A 2 Agree Strongly Agree Slightly Disagree
1/1/2012 A 1 Agree Agree Disagree
1/1/2012 A 2 Disagree Disagree Disagree
... etc 8,000 rows ...
What he would like is a report that looks similar to this:
School Class Q1 Agree Q1 Disagree ... Q1 Strongly Agree ...
====== ===== ======== =========== =================
A 1 2 1 0
A 2 1 1 0
... etc ...
Obviously I'm looking at a pivot table, but I'm running into an issue with how to define the pivot table. I'm not an expert at Excel, but when we tried various options we came up with essentially non-sensical results.
Is it possible to set up a pivot table that will give this data in a meaningful way? Counting instances of non-numeric values and grouping the counts by school and class? What would be a good (easily repeatable) strategy to accomplish this?
Thanks for any help, much appreciated.
(We are using Office 2007)

Select your datarange as a pivottable.
Drag Question 1, Class, and School to the Row Labels box.
Drag Question 1, Question 2, and Question 3 to the Values box.
If it doesn't say "Count of Question 1", click the downward arrow on Value Field Settings.
In the Summarize by tab, select Count.
Repeat as neccesary.
On another sheet, link to the specific pivot table cells to display the data in whatever format you wish.
edit: I have attached an image as a visual aid.
http://i.imgur.com/2Emw3.jpg
Let me know if you have any questions.

Fill a second sheet with formulas that concatenate School and Class and Answer.
The table would afterwards look like this:
Q1 Q2 Q3
=================================================================
A1Q1:Agree A1Q2:Strongly Agree A1Q3:Disagree
A1Q1:Disagree A1Q2:Agree A1Q3:Strongly Disagree
A2Q1:Agree A2Q2:Strongly Agree A2Q3:Slightly Disagree
Where A1 means School A Class 1.
You could even work with VLookup to replace the text with numbers
You can get this by adding this formula to Cell D3 in the dummy table:
=sourcetable!$B3&sourcetable!$C3&D$1&":"&sourcetable!D3
and then copy it to every cell.
Now all you have to do is create a result table like this:
Q1 Q1 Q1
School Class Agree Disagree Strongly Disagree
========================================================================
A 1 formula
where formula is
=countif(dummytable!C3:z999,$A4&B4&C$1&":"&C$2)
repeat this formula for all cells.
What the first part does and how it does it should be clear. In a production-level application I would replace the text (Agree/Disagree) with numbers (google for VLookup) the you see when there's a typo in the data.
The second part counts all occurrences of the string (in this case A1Q1:Agree). This should do the trick.
If you want to publis it, it is a good Idea to "copy:paste values" the result into a new table...
You can reuse the dummytable and the result table as is. Just drop the new data into sourcetable...

The issue is that your data is all ready partially pivoted.
Ideally it would be in the format:
DateTime School Class Question Answer
======== ====== ===== ========== ==========
1/1/2012 A 1 Question 1 Strongly Agree
1/1/2012 A 1 Question 2 Agree
etc
That format would lend itself to better work with a pivot table.
Here is instructions on doing an unpivot with Excel 2016

Related

How to choose the highest number from a set of same names?

I am trying to modify an already existing Excel file for a client. Here is the deal. They have the following Excel sheet with these columns (the picture is a simplified version of course to make it clear to you):1
If a student has completed their Bachelor they get a 1 in the Bachelor Done column, if not they get a 0. Now what they want is to check if at least one person per city has completed their Bachelor and display this in a new table with two columns (First column with the city name and second column with a Note of Yes or No).
For example let's take Lisbon. It has 2 students, George and Helen. In this case George has not completed his bachelor yet (0) but Helen has (1). In that case, Lisbon qualifies and should get a Note of YES in the new table.
Is there any way to implement this in Excel via an IF or a VLOOKUP function? I tried, but my Excel knowledge is quite limited. They also do not want to change the format of the file, as lots of people are already working with this and they are familiar with. Best case scenario could probably be the addition of extra columns.
My question is if there is a way to find for every city the highest Bachelor Done number and based on that to have a Yes or No output. The numbers for Bachelor will always be 1 or 0. So if a city has 1 and 0, 1 should be taken and display yes. If there is a city with 3 people and only zeros, No should be displayed.
If you need any clarification, please let me know.
First copy and paste all your distinct City names into a column, then remove duplicates (data... remove duplicates). In my case, I did that in column F. Then in column G, input a formula such as this:
=IF(MAXIFS(C:C,A:A,F2) = 1, "YES", "NO")
Results:

i need an excel formual that watches a column type

Ok to paint a picture.
A sheet named bob another sheet named joe.
These sheets will have a column listed as type. it will be say E3 thru E100
in this column there will be either W, CPC, Or AMW.
A separate sheet named main will be looking at these sheets bob and joe and the column type E3 thru E100.
if the column has a w then it would count that as 1
if it has a cpc then is would count that as 1
if it has amw then it would count that as one.
And for each time it sees one of these it will added it up and tally a total back on the sheet name main.
This formula would be written 2 times for each person so it would show how many warranty jobs they did or how many customer paid jobs they did or how many aftermarket warranty job they did.
I am trying to make my job easier when i import a report from work.
can this be done is the question?
Thank you in advanced and please beware i am an idiot when it comes this stuff.
I am an ASE technician managing i group of techs and trying to make my reports not take as long as they do now which is all day so thank you in advance
Mike
It's sounds terrible, in first instance I do believe that you are trying to Count 3 codes, but unable to understand for whom,, as described later,, so better post either screen shots or sample data, help me to solve the problem.

Report on data for a particular month

I have a data sheet in Excel that gets populated with generic information first (Data, Project code etc.) and then along columns there are questions asked in a survey (40 in total). There are predefined answers (A, B, C etc.)
So a Row would look a little something like this:
Date / Contract# / Sector / Q1 / Q2 / Q3.......... Q40
12/05 010632 Department A B N/A.......... Not Checked
20/07 022365 Department N/A C Not Checked.. Not Checked
01/10 032501 Department A A N/A.......... Not Checked
What I would like to report on is for a particular month, give me the questions with the most "A" answers showing the following (for instance).
What would be the best way to do this?
I cannot seem to get it to work in PivotTables and VLOOKUPs, but not sure they are best suited for this extraction of data.
I would properly go for the next free column as a countif formula reaching over the question answers, so countif(D2:AD2,"A") I Say AD2 But just drag until questions have all been selected on that row....Then in the next column either a month formula as suggested or a TEXT(A2,"MMMMMM") Will show the month....Then Standard pivot.
Hope this helps
Thanks
Chris

sports scoring in multiple phases in excel

I have a question about excel.
There is a sports tournament with multiple phases. And the results page looks something like this:
rank phase1 phase2
1 TOM ALBERT
2 MATT TOM
3 ROBIN MATT
The first place gets 5 points, second 3 and third 1 points.
So the summary I would like to get is like this
rank name phase1 phase2 total
1 TOM 5 3 8
2 ALBERT 0 5 5
3 MATT 3 1 4
4 ROBIN 1 0 1
I cant figure out how to generate it simply, so if I copy-paste the results from phase3 to somewhere in my excel sheet, the summary page would also update.
If you can support me with advice or just a working template, I would be thankful!
Thank you for your time!
I've done you a basic example below...just list all 50 players in the summary page and copy the formula down as it is - as per the question it only records a value for the top 3 places, hope this helps if not please let me know :)
Example file here
Assuming the structure you defined and that when you paste phase 3 it will have its header ("phase3") on the same row as the other results, you could have the following formula on your Table 2:
{=SUM(IF(IFERROR(MATCH($B2,INDIRECT("Sheet1!"&CHAR(64+MATCH(C$1,Sheet1!$1:$1,0))&":"&CHAR(64+MATCH(C$1,Sheet1!$1:$1,0))),0)-1,0)={1,2,3},{5,3,1},0))}
Note: entered as Array formula: CTRL + SHIFT + ENTER
Formula uses the Table 2 headers ("phase1","phase2", etc.) and the players names to find the results for each phase. It then uses the predefined arrays that determine points given per position. The final sum is to bring the result that are in array (other values in array are 0) into single value.
Total would sum results per player.
Under the rank cells you would place the following formula:
=RANK(F2,$F:$F)
Which would provide you the rank of each player (Column F containing the totals).
Note that this would not sort your rank automatically but you could easily do this with Sorting or Autofilter. Hope this helps. Cheers.

Using QUARTILE in an Excel pivot table to summarise data by sub-populations

I've got a large table of data in an Excel spreadsheet that, essentially, can be considered to be a collection of values for individuals identified as belonging to various subpopulations:
IndivID SubPopID Value
1 A 33.56
2 E 42.31
3 D 16.35
4 A 50.59
5 F 80.63
...
There are over 10,000 individuals in this table, and over 50 subpopulations.
I would like to calculate the 5-number summary (Min, Q1, Median, Q3, Max) for each of the subpopulations.
Min and Max are easy in a pivot table. But Q1, Q2 (median), and Q3 don't seem to be possible.
Question
Is there any way to calculate the quartiles for each subpopulation in a pivot table in Excel?
The answer should look like this:
SubPopID Min Q1 Q2 Q3 Max
A 3.23 12.06 20.35 28.29 50.59
B
C
...
My experience is that you can't do percentiles in a pivot table. I just did a web search and don't see anything to contradict that. I think the best you can do is have your source data in a table so you can refer to it dynamically, and then use the percentile function in another table.
I've seen one article about using PowerPivot, but that's only available in Excel 2010, and it looks hard. I have 2010, and when faced with a similar problem, I still opted to go the route I'm suggesting here.
EDIT: Explanation of my proposed alternative:
In answer to your question in the comments, here's how I'd calculate percentiles from a table of data:
It relies on an single formula, which is the same for every cell from F2 to H6. It's an array formula, meaning it's entered with Ctrl-Shift-Enter. It uses an IF statement to filter on the various possible SubPopIDs. Here's the formula for F2:
=PERCENTILE(IF(Table1[SubPopID]=F$1,Table1[Value],""),$E2/100)
If you need to check a condition for more than one column (a=1 AND b=2) you can expand the array using the * character
=PERCENTILE((IF((Table1[SubPopID]=[condition1]) * (Table1[SubPopID2]=[condition2]),Table1[Value]),""),$E2/100)
I found this answer where a solution is described.
It uses the same aproach as described by Doug Glancy but associate it with a calculated field in the pivot table. The answer gives an example excel file.

Resources