**Video Transcript**

One of the most common things that spreadsheet experts ask about Numbers is can you do pivot tables with them. Pivot tables are kind of an expert level technique that people commonly do in Microsoft Excel. You can't really do pivot tables in Numbers. Prior to 2013, in the original version of Numbers, you could do something called Categories which was kind of the same thing. But you can't do that anymore.

However, what people are mostly looking for when they're doing pivot tables is being able to get a specific type of data from a table. You can actually do that using some formulas in Numbers. So it's not like you can't do it at all. So let's simulate a typical use of pivot tables in the current version of Numbers.

So here's a table that's got a list of sales. You can see a bunch of products that are repeated. So you have apples, apples, apples, and oranges, oranges, oranges. You've got the numbers sold and the price. A typical thing you may want to do with a pivot table is to say, okay how many apples have been sold total in this table. So only take into account the rows with apples in them and then count up the number sold. So you could use Sum If for this. So I could say, basically, what's the sums if the product column is equal to apples. You could build that formula in another table and easily say I want it for apples, I want it for oranges, and I want it for pears.

But what pivot tables do is they don't, you know, rely on you actually identifying which products they are. It automatically analyzes the table and figures out, for instance, that there are three different type of products here and that it sums up apples, oranges, and pears automatically. So let's do that because we can actually do that with formulas.

The first thing we're going to do is we're going to add one more column here. Just click here on this little equals sign. We're going to add a column and that column is going to be called, First. So we're going to enter a formula in here and we're going to use the match function. Here's the definition of the match function. I have it up here on the right. It says it returns the position of the value within the collection. The parameters are search for, search where, and the matching method.

So, search for. We're going to search for the value of the cell in column B. In this case it would be apples. But the next row would be oranges. Search where, we're going to do search in column B, which is called the product column. So it's going to search for apples there and the matching method is going to be find value. It's going to give me the first value. The first time it gets to it. Let's see what the results are. Now you get a $2.00 which is confusing until you realize oh, it must be taking the formatting of column E from column D so let's select column E and change the formatting to automatic and we see it's number 2. Interesting.

Let's copy and paste it in a bunch of these cells. What do we get? Well, oranges we get 3 and we notice that the first row with oranges is 3. The first row of apples is 2. The next row of apples gives us 2 because the first occurrence is row 2. So it's giving us the first row with that in there. So, let's complete this formula by tagging onto the end there an equals sign. We're going to use the Row function. The Row function will give us the row of a cell. But if we leave it blank, nothing inside the parentheses, it'll give us the current row. In other words 2. So we get a TRUE here. Why do we get a TRUE here? Because it looks up apples and it finds apples is first in row 2 and it compares that to the current row, row 2, and says it's TRUE. Oranges, the same thing. It's first in row 3 and this is row 3. It's TRUE. We go to the next row we get FALSE. As a matter of fact if we paste it in here we're going to get mostly FALSE except for TRUE only the first time something appears. So the first time apples appears, the first time oranges appears, and the first time pears appears because that's the only time that the first occurrence of the product is the same as the current row. Every other time it's FALSE.

So let's make sure we have that pasted in all of these. Now we have a nice TRUE the first time each one of these products appears. Let's add another column. This column is going to be called Count By Product. Now usually with pivot tables you're either trying to count something, total something up, do the sum or get the average. You have formulas Count If, Sum If, Average If for all of these. So now we just need to use those formulas here.

So we'll do a formula here and we'll start with Sum If. We're going to see that the Sum If takes test values, conditions, and sum values. Test Values are going to be let's test everything in the product column. If it equals the exact value of what we have in the cell in this row in the product column then we're going to add it up and we're going to total it up based on the number sold with parentheses there. We get 213. 213 is the total number of apples sold. Now if I copy and paste that here what I get is here I get the total number of apples, here I get the total number of oranges, again the total number of apples, again apples, oranges, pears, etc. Which is just a confusing list of numbers.

What we want is for it to only appear once. The first time we see each one of these. So what we're going to do, is we're going to qualify this with an If statement. The way if statements work is they taken an expression and what value to put in the cell if it's true and what value to put in the cell if it's false. So we'll start off with If and the condition will be whatever appears in column E. So it's those TRUE's and FALSE's we were working on before. If it's true we'll put the number there. If it's false we're actually going to put little quote quote for a blank.

So I get 213 for the first one but if I paste it in all of these you could see I only get that value when the column here is TRUE. So I get apples, oranges, and pears I get the total there. This already is very useful and will fulfill most peoples' needs for a pivot table. Because whatever I do here it is going to actually just show me these things here. I can hide this column here because it's not very useful for me to see and just have these numbers here. I know that the first time I see one, oh there's a 52 and that's pears. So the first time I see it. Now you may have already notice there's another one down here. There's bananas as the last two. You can see the first time it appears there it's 22.

What you may want from this really is a simple table here. You can do that using Filtering. So I can select this whole table here. I can click on Sort and Filter. I'll do Filter and I'll Add a Filter. I'll say when the First column, and I'll have it when the text is True, then, only then, display it. So you can see it filters it. In addition to that I can go ahead and I can Hide these other ones here because these don't apply. This is the number sold for the very first apples and the price sold for the very first apples. I just want the count by product. So I'm going to select these three columns here and I'm going to say Hide Selected Columns. The result I get just from hiding, so I'm hiding those columns, and Sort and Filtering, I'm sort and filtering the rows so it's only the True ones, I get the list of products and the count by product.

Filters are nice because I can uncheck them here and turn them off. The hiding isn't so nice. You have to Unhide All Columns to get it back. There's a couple steps there to get down to that nice small table from the big table but it does give you a result that you can then print out or create a PDF to hand in as part of a report. So that takes care of a lot of the different things that pivot tables do for Microsoft Excel users. You can do them now in Numbers.

However, what people are mostly looking for when they're doing pivot tables is being able to get a specific type of data from a table. You can actually do that using some formulas in Numbers. So it's not like you can't do it at all. So let's simulate a typical use of pivot tables in the current version of Numbers.

So here's a table that's got a list of sales. You can see a bunch of products that are repeated. So you have apples, apples, apples, and oranges, oranges, oranges. You've got the numbers sold and the price. A typical thing you may want to do with a pivot table is to say, okay how many apples have been sold total in this table. So only take into account the rows with apples in them and then count up the number sold. So you could use Sum If for this. So I could say, basically, what's the sums if the product column is equal to apples. You could build that formula in another table and easily say I want it for apples, I want it for oranges, and I want it for pears.

But what pivot tables do is they don't, you know, rely on you actually identifying which products they are. It automatically analyzes the table and figures out, for instance, that there are three different type of products here and that it sums up apples, oranges, and pears automatically. So let's do that because we can actually do that with formulas.

The first thing we're going to do is we're going to add one more column here. Just click here on this little equals sign. We're going to add a column and that column is going to be called, First. So we're going to enter a formula in here and we're going to use the match function. Here's the definition of the match function. I have it up here on the right. It says it returns the position of the value within the collection. The parameters are search for, search where, and the matching method.

So, search for. We're going to search for the value of the cell in column B. In this case it would be apples. But the next row would be oranges. Search where, we're going to do search in column B, which is called the product column. So it's going to search for apples there and the matching method is going to be find value. It's going to give me the first value. The first time it gets to it. Let's see what the results are. Now you get a $2.00 which is confusing until you realize oh, it must be taking the formatting of column E from column D so let's select column E and change the formatting to automatic and we see it's number 2. Interesting.

Let's copy and paste it in a bunch of these cells. What do we get? Well, oranges we get 3 and we notice that the first row with oranges is 3. The first row of apples is 2. The next row of apples gives us 2 because the first occurrence is row 2. So it's giving us the first row with that in there. So, let's complete this formula by tagging onto the end there an equals sign. We're going to use the Row function. The Row function will give us the row of a cell. But if we leave it blank, nothing inside the parentheses, it'll give us the current row. In other words 2. So we get a TRUE here. Why do we get a TRUE here? Because it looks up apples and it finds apples is first in row 2 and it compares that to the current row, row 2, and says it's TRUE. Oranges, the same thing. It's first in row 3 and this is row 3. It's TRUE. We go to the next row we get FALSE. As a matter of fact if we paste it in here we're going to get mostly FALSE except for TRUE only the first time something appears. So the first time apples appears, the first time oranges appears, and the first time pears appears because that's the only time that the first occurrence of the product is the same as the current row. Every other time it's FALSE.

So let's make sure we have that pasted in all of these. Now we have a nice TRUE the first time each one of these products appears. Let's add another column. This column is going to be called Count By Product. Now usually with pivot tables you're either trying to count something, total something up, do the sum or get the average. You have formulas Count If, Sum If, Average If for all of these. So now we just need to use those formulas here.

So we'll do a formula here and we'll start with Sum If. We're going to see that the Sum If takes test values, conditions, and sum values. Test Values are going to be let's test everything in the product column. If it equals the exact value of what we have in the cell in this row in the product column then we're going to add it up and we're going to total it up based on the number sold with parentheses there. We get 213. 213 is the total number of apples sold. Now if I copy and paste that here what I get is here I get the total number of apples, here I get the total number of oranges, again the total number of apples, again apples, oranges, pears, etc. Which is just a confusing list of numbers.

What we want is for it to only appear once. The first time we see each one of these. So what we're going to do, is we're going to qualify this with an If statement. The way if statements work is they taken an expression and what value to put in the cell if it's true and what value to put in the cell if it's false. So we'll start off with If and the condition will be whatever appears in column E. So it's those TRUE's and FALSE's we were working on before. If it's true we'll put the number there. If it's false we're actually going to put little quote quote for a blank.

So I get 213 for the first one but if I paste it in all of these you could see I only get that value when the column here is TRUE. So I get apples, oranges, and pears I get the total there. This already is very useful and will fulfill most peoples' needs for a pivot table. Because whatever I do here it is going to actually just show me these things here. I can hide this column here because it's not very useful for me to see and just have these numbers here. I know that the first time I see one, oh there's a 52 and that's pears. So the first time I see it. Now you may have already notice there's another one down here. There's bananas as the last two. You can see the first time it appears there it's 22.

What you may want from this really is a simple table here. You can do that using Filtering. So I can select this whole table here. I can click on Sort and Filter. I'll do Filter and I'll Add a Filter. I'll say when the First column, and I'll have it when the text is True, then, only then, display it. So you can see it filters it. In addition to that I can go ahead and I can Hide these other ones here because these don't apply. This is the number sold for the very first apples and the price sold for the very first apples. I just want the count by product. So I'm going to select these three columns here and I'm going to say Hide Selected Columns. The result I get just from hiding, so I'm hiding those columns, and Sort and Filtering, I'm sort and filtering the rows so it's only the True ones, I get the list of products and the count by product.

Filters are nice because I can uncheck them here and turn them off. The hiding isn't so nice. You have to Unhide All Columns to get it back. There's a couple steps there to get down to that nice small table from the big table but it does give you a result that you can then print out or create a PDF to hand in as part of a report. So that takes care of a lot of the different things that pivot tables do for Microsoft Excel users. You can do them now in Numbers.

Fantastic work around and, as always, clearly instructed/demonstrated. You are awesome!

Thanks Gary,

Pivot table functionality is a great loss to numbers. Mac users have the right to feel cheated here. Excel, the undisputed best spreadsheet, after all, started on Apple.

Is the assumption that apple users don’t need advanced functionality?

Your clever solution is of great help.

I was really wondering why I moved to Mac, or for that matter from calculator, pencil and paper.

Bruce: Numbers may not have pivot tables, but then Excel doesn’t have the multi-table spreadsheet functionality that Numbers has. There are strengths for each. And I don’t see how Mac users are cheated here as Excel is available for both Mac and Windows. You have to pay Excel it on either. At least on Mac you et Numbers for free, which handles most of what people need without having to pay for Excel.

It would be nice if you could create another table to summarize results with out having to use Filters and Hide columns.