2.4. Part III Comparing Happiness Data across years¶
We have two files of happiness data, one for 2017 that you have been using, and another for 2012 so you can do some comparisons across a span of five years.
 Start a new workbook and get each of the csv files for the happiness data loaded into a separate sheet.
 Now lets create a table on a new sheet that shows the happiness rank for each country for each year. You’ll have 4 columns country name, 2012 rank, and 2017 rank. Hint: Use VLOOKUP – But wait! What is the deal with these #N/A values? Shouldn’t the happiness report have the same countries for every year? Apparently just like regular people not all countries participated in the survey every year. Lets press on and hope for best for the moment…
Now create a column where you calculate the change between the 2017 rank and the 2012 rank. Then create a new cell where you find the max value of this new column.
Oh dear, hoping for the best is rarely a good strategy. You will notice that the result of looking for the max value in column that contains one of these #N/A values results in the function returning #N/A as well! It appears we will have to find a better strategy.
The right way to handle this problem is to use the IFERROR function of Google Sheets. This is one area where Google and Excel are slightly different. In Excel the function is called ONERROR, but they behave the same in any case. The IFERROR function takes two parameters. A function or calculation, and a value to insert in the case of an error. In our case we want to adjust our subtraction so that if there is an error we will set the difference to be 0. We’ll change the calculation to look something like =IFERROR(C2P2, 0) Now you will see that wherever we had an #N/A value before we now have a 0. You will also see that we get interesting values for max and min.
Q1: What is the name of the country with the largest positive change in their happiness rank? What about the largest negative change? ?
 Next let us find the biggest changes in the happiness scores from 2012 to 2017
 False
 Surprisingly yes.
 True
 No, the countries are different. If you are guessing you better complete this part to find out who they are and investigate why that might be.
Q2: Are the countries that with the largest change in rank the same as the countries with the largest change in score?
Q3: What is the name of the country with the largest positive change in their happiness score? What about the largest negative change? ?
Q4: Give an explanation for why you think the two are different? Outline an experiment or calculation that you can do with a spreadsheet to back up your answer.
 For the five countries with the largest changes changes in ranking between 2012 and 2017 what are the factors that changed the most? For this part you can do this by making comparisons between sheets rather than creating a huge number of new columns on this summary sheet.
Q5: What did you learn in the previous investigation? What were the factors that changed the most?
Challenge
 The choropleth gave us some insight into how happiness may be related to the continent. It was pretty clear that African nations were less happy than many others. Lets see if we can quantify that.
 First we need to find a file that helps us map from country to continent. Lets add this to our file as a new worksheet.
 How can we add a column (or a few columns) to our happiness spreadsheet from this spreadsheet? – VLOOKUP
 Once we have the continent name added to the spreadsheet can we find the average happiness score for each continent?
Lesson Feedback

During this lesson I was primarily in my...
 Comfort Zone
 Learning Zone
 Panic Zone

Completing this lesson took...
 Very little time
 A reasonable amount of time
 More time than is reasonable

Based on my own interests and needs, the things taught in this lesson...
 Don't seem worth learning
 May be worth learning
 Are definitely worth learning

For me to master the things taught in this lesson feels...
 Definitely within reach
 Within reach if I try my hardest
 Out of reach no matter how hard I try