krues8dr committed Nov 6, 2016
Showing with 24 additions and 8 deletions.
1. +24 −8 pivot-tables.md
 @@ -27,46 +27,62 @@ To create our pivot table, select "Insert" and click "PivotTable." Stay with the With our pivot table in place, let's start looking at the data: Youtube Video What Excel did was add up all the spending done in all of the countries and organized it by program. So, the U.S. spent about \$15.5 million on Child Survival and Health programs around the world in 2009. Now let's organize this data so we can see where the money is going: Youtube Video Of course, it would be a lot easier to read this data if it were formatted properly. No problem: Youtube Video

Working the count

Another question one might ask this data is, how many foreign aid programs is the U.S. running in each country? This is easily answered using the "count" function. Youtube Video

Playing the percentages

Another useful function is calculating percentages. For example, maybe we'd like to break down 2009 program spending by percentage. Youtube Video We can also look at what percentage of all aid since 1946 was handed out in 2009. To do this, we'll need to add a new column in our data tab totaling all the years for each country and program. We'll call this column "Total." Youtube Video Now, let's create a new pivot table with "country_name" in the row labels and "Total" in values. Be sure to set total to "sum." Then we'll need to create a new column in our pivot table: Youtube Video

Comparisons

Finally, you can add multiple values if you want to make side-by-side comparisons. Simply remove "Total" from the value box and instead add two years, say 2000 and 2009. Make sure to set both to "sum of." Youtube Video As you can see, pivot tables are incredibly powerful, if not always intuitive. But, with a little patience, you can start using them to better analyze and understand your data.