Chapter 14. Segmentation: Slice and dice

image with no caption

Get creative with your tools.

You’ve developed a formidable knowledge of Excel in the past 13 chapters, and by now you know (or know how to find) most of the tools that fit your data problems. But what if your problems don’t fit those tools? What if you don’t even have the data you need all in one place, or your data is divided into categories that don’t fit your analytical objectives? In this final chapter, you’ll use lookup functions along with some of the tools you already know to slice new segments out of your data and get really creative with Excel’s tools.

Geopolitical Grunts is a swashbuckling group of policy geeks who advise businesses and governments on the most important macro trends of the day. They need your help doing some hardcore pivot table work.

The data set describes the spending of the U.S. federal government at the county level for the past couple years.

image with no caption
image with no caption

The folks at Geopolitical Grunts sent you this database, which is a county-by-county summary of U.S. federal government spending over the past couple years. And because it’s almost 50,000 lines, you might want to close other programs before loading it!

image with no caption
image with no caption

Data can be close to what you want without ever quite getting there. But that doesn’t mean that you can’t do your analysis. You can just transform the data you have into the data you need to have.

image with no caption

Calculating the Per_Household figure was straightforward, because you had all the data you needed right there on the spreadsheet.

image with no caption

But you’re in a different situation with Region, since there’s nothing implicit in the data that you can use to calculate Region. You need to incorporate more data in order to determine the region for each row.

image with no caption

You can poke around in search engines for a few minutes and find data like this: a key that shows how state names fit with regions.

A particularly useful function in Excel is VLOOKUP. The V stands for vertical, and what the function does is look up a reference value in a vertical list and then return the value from another column that matches the position of the value in the vertical list.

image with no caption
image with no caption

Oh, bother. So it looks like you’re going to have to cross-reference the region to the state abbreviation, then use that abbreviation to cross-reference the region to your original data. Fortunately, VLOOKUP will make quick work of bringing these data sets together.

image with no caption

The data you receive to analyze inside Excel is just a starting point. If that data doesn’t do what you need it to do for your analysis, every tool of Excel is at your disposal to mutate the data into the form you need.

That’s what slicing and dicing data is all about.

image with no caption
image with no caption

Ah, clients.... What are you going to do? You flash a little skill, and once they know what you’re capable of doing, they’ll never leave you alone!

Which is a good thing, because there’s a whole lot of it. So much of it, that it’s hard to keep track of it all. There’s so much of it that you could get buried in it all

image with no caption
image with no caption

We’re sad to see you leave, but there’s nothing like taking what you’ve learned and putting it to use. You’re just beginning your Excel journey, and we’ve put you in the driver’s seat. We’re dying to hear how things go, so drop us a line at the Head First Labs website, www.headfirstlabs.com, and let us know how data analysis is paying off for YOU!