Creating Error-Free Spreadsheets with Pivot Tables and Formulas: Tips and Techniques

Spreadsheets are an integral part of data analysis and reporting in many business and academic settings. Microsoft Excel, one of the most widely used spreadsheet applications, offers a range of features to manipulate and visualize data. Among these features, Pivot Tables and formulas stand out for their ability to summarize and calculate data efficiently. However, mastering these tools requires understanding common pitfalls and learning how to avoid them. This blog will guide you through tips for creating error-free Pivot Tables and formulas.


Understanding Pivot Tables

A Pivot Table is an Excel feature that allows you to reorganize and summarize selected columns and rows of data in a spreadsheet. It enables you to extract significant insights by rotating data axes and calculating totals, averages, and other aggregations.


Creating a Pivot Table

To create a Pivot Table, follow these steps:

1. Select Your Data: Click on any cell within your dataset.
2. Insert Pivot Table: Go to the `Insert` tab and click on `Pivot Table`.
3. Choose Table/Range: Excel will automatically select the data for your Pivot Table. Confirm the selection.
4. Choose Where to Place the Pivot Table: Select `New Worksheet` or `Existing Worksheet`, depending on your preference.
5. Drag and Drop Fields: In the Pivot Table Fields pane, drag fields to the Rows, Columns, Values, and Filters areas to organize your data.


Example of a Pivot Table

Suppose you have the following sales data:

| Product  | Region | Sales  |
| Product A| East   | $5,000 |
| Product B| West   | $7,000 |
| Product A| East   | $8,000 |
| Product C| North  | $3,000 |

To analyze total sales by product, you would create a Pivot Table and drag the `Product` field to Rows and the `Sales` field to Values. The result would be:

| Product  | Sum of Sales |
| Product A| $13,000      |
| Product B| $7,000       |
| Product C| $3,000       |


Mastering Formulas

Formulas are expressions that calculate the value of a cell. They can range from simple arithmetic to complex functions.


Tips for Error-Free Formulas

  1. Use Cell References: Instead of typing numbers directly into your formulas, use cell references. This makes your formulas dynamic and easier to update.
    2. Start with Equal Sign: Every formula must begin with an equal sign (=).
    3. Match Parentheses: Ensure that all opened parentheses are properly closed.
    4. Use Functions Wisely: Understand the purpose of Excel functions and use them appropriately.
    5. Copy Formulas with Care: When copying formulas, be aware of relative and absolute cell references. Use the `$` symbol to fix a reference if needed. 

Example of a Formula

If you want to calculate the total sales in the above example, you could use the SUM function:


This formula will add up all the values in the range B2 through B5, giving you the total sales.


Combining Pivot Tables and Formulas

You can enhance your data analysis by using formulas within your Pivot Tables. For instance, you can create calculated fields to perform additional calculations on your summarized data.


Example of a Calculated Field

If you want to calculate the commission for each product based on the sales, you could add a calculated field:

1. Click anywhere in your Pivot Table.
2. Go to the `PivotTable Analyze` tab and click on `Fields, Items, & Sets`.
3. Select `Calculated Field`.
4. Enter a name for the field, such as “Commission”.
5. In the Formula box, enter `=0.1 * Sales` to calculate a 10% commission.
6. Click `Add`, then `OK`.

Your Pivot Table will now include a commission calculation for each product.



Mastering Pivot Tables and formulas in Excel is essential for anyone looking to perform sophisticated data analysis. By following the tips provided in this blog, you can ensure that your spreadsheets are error-free and your analyses are accurate. Remember to organize your data well, use formulas with care, and leverage the power of Pivot Tables to summarize and extract insights from your data. With practice and attention to detail, you’ll become proficient in using these powerful Excel features to their full potential.


Live Excel Support Transcript Example:

Below is a live transcript of one of our Excel Support experts helping a customer with a spreadsheet error:

Full Conversation:

Customer: And just, okay. Oh, now he’s telling me that he’s putting it, oh, okay, nevermind, I see it now. Okay. Okay, so what are you trying to do? I think I’m gonna have to refresh this page. For some reason, sometimes it won’t let you edit. So, let me show you what I’ve got. So, what I want is what I’ve manually done to the side of the pivot table, simply just a division of these two. For some reason, if I try to add anything more, it messes the entire table up. If I pick another calculated field or an order day, it blows everything out.
Technician: Yeah, because you didn’t, did you add that as another thing? Because it looks like column D is just another formula, right?
Customer: Right now, so would that mean that I actually just need to insert a column then it’ll let me do it?
Technician: Yeah, I think so.
Customer: Ah. Yeah, yeah. So, that’s what was happening, because E is not a calculated field in the pivot table. When it tries to add another column in the pivot table, it says, ah, there’s already something here. Got it. So, yeah. I think that should solve everything.
Technician: Cool, well, I’m glad that was easy. Save, and I’ll just, hopefully I can copy that over. Or I can just hang for half a second, make sure I’ve got you.
Customer: Does this have to do with the naming convention I’ve used?
Technician: I think, yeah, why is it doing that? I’m not sure. I would probably put, though, I would just click on them, because that way it’ll definitely put it in the right format. So, like, just equals and then click C2 and then divide it by B2.
Customer: I didn’t take that.
Technician: All right. So, let’s see. Oh, this says that the syntax is, you don’t put quotes around it. Okay, so it’s single quotes to make order date work. Let’s see, and there’s a space, so I was wondering if that would really, yeah. I had to do that for order date and Facebook ads cost. That’s strange. No, some, I bet custom. That’s what I had to do as well. Let me see. I’ve got to look up the syntax, because I always get it mixed up switching back and forth with Excel. But, should be, ah. So, yeah, this says, okay, that single quotes should work. But if you just do that, it gives you an error. That’s so strange. Facebook ads cost. Yep, that’s the same capitalization. Okay. It’s not having an issue with the XLOOKUP field, trying to pull from that, I wouldn’t think, right? I shouldn’t, that wouldn’t make much sense. Um. So, yeah, it should just do that. Can you add me as an editor on this worksheet?
Customer: Sure.
Technician: All right, I’m gonna put my email address in the thing. It’s just carl.zippel at Let’s see, that’s not chat. Okay, there we go. Yeah. Pivot table four. All right, give me just one sec. Pivot table four, okay. So. Why is this loading so slow? It’s not putting me in the pivot table editor. Sorry, it wants, I don’t know what it’s doing here. We got a forklift or a smoke alarm in here. Yeah, it’s one of those giant sky lifts. They’re doing something on the floor above me. I thought they were gonna be done yesterday, but apparently not. Better than a smoke alarm. That’s true. Oh, for some reason it just says waiting when it’s trying to load the pivot table editing part. That’s not helpful at all, Google. What the hell? Let me try refreshing. Sorry about that. I’ve got the meeting paused because I don’t know what it’s doing. But for some reason, it’s not letting me edit the thing. It doesn’t make it like I can edit the other stuff, but in the pivot table, it just won’t. Oh, there it is. Okay, fine. Okay, so I got it now, I think. So all right, if we do the easiest possible formula, that works. So it isn’t that. And then if we change that, that we got an error. Does just order date work? Okay, that works, but not. That’s an error. Is it? It’s so strange. I really don’t know why it would give us that. Why? Okay, here’s a thought. Can we take the formula from Facebook ad costs, copy it with divided total sales Shopify all channels? And just do it all in one in the next field? No, doesn’t like that either. Oh, it’s some, it won’t work with some. Oh, okay, so we changed the custom. Yeah. Okay. And divided by the Shopify field. Divided by. Okay. It doesn’t like the division from that formula for some reason. Is that it? Because I mean, if we replace with something else, like we add, it doesn’t work any better. Well, yeah, I mean, it doesn’t like some, like calculation on that X lookup, right? Like, cause if you just try like plus one, does it just jack the whole thing up? Nope, that works. What about if you divide it by something in E, which is in a pivot table? Me too. Yeah, I don’t think you can reference things outside the pivot table. I mean, but if we tried this divided by a hard-coded number, that works fine, so that’s not the problem. So if we. Okay. I wonder if we add another cell E, and if we just try to reference total sales Shopify all channels, if it creates an error, because that name is just not something it likes. It shouldn’t make, I mean, if we accept it as a valid name, it shouldn’t. Okay. It shouldn’t make a difference. Okay. All right, what if we do. No. I really don’t know. That is a mystery. Oh. Oh, that’s not right. Well, let me copy it. Not from, I think you have to copy it from the formula bar. Oh. Oh. So, I’m just gonna try it, but. Yeah, I think that what it is, is that doing calculations on calculated fields isn’t working. I vaguely remember running into this problem before. Then it should work here, right? Should work where? Facebook ads cost, if we just did it there, then it should work, right? What do you mean? If we did it there instead of in the next field over, if we just did it in Facebook ads cost. So, if we just took that field and just divided by total sales shop file channels, it should work. Oh, I see. Yeah. Let’s see. If you have a good way of adding that total sales number really quickly, then I’ll let you do that. So, if we just do that. Well, what if we try to just do this? Yeah. Yeah, it’s not even letting us reference the total sales column. Even if you switch that to custom. If we rename that total sales without the parentheses and the dash, you think it might tolerate it? I don’t know if we can just change it. Yeah, you can’t. Let’s see. Okay. Yeah, it doesn’t even recognize that name. Oh, now it needs the, but it needs the single print or the single quote, right? No. Okay, no. Yeah. I freaking hate using pivot tables in sheets. They’re so tacked on at the last second. Yeah. Yeah, I don’t. I don’t know. I’m stumped too. Hmm. The fact that we can’t reference total is obviously the problem, right? Yeah, I mean, that doesn’t, it doesn’t make a lot of sense. Like, I don’t know why we can’t reference it. Like, if it lets us, I don’t know. Yeah, it doesn’t make sense. So total is a count A. Yeah. Stylized by. Is it the issue that it’s, these are custom or that’s a different kind of summary field of some sort? I mean, is that- It shouldn’t be. This is kind of crazy, but if we added one in between and we had it just, oh no, because it can’t reference still. Nevermind. Yeah, I got no idea. I don’t know. I don’t know. I don’t know. I don’t know. I don’t know. I don’t know. I don’t know. I don’t know. I don’t know. I have no idea. Okay. I appreciate you getting into it. This is a very wonky. Yeah. No, it’s so weird. I’m going to have to try to figure out, like I’m going to make my own thing and like try to figure out what’s going on. Cause this should work. The only thing I want on top of my head is if you took how the total figures and if you embedded it at the end of the X lookup. Yeah. Right. Yeah. Because where is it counting from? You know, off the top of your head. It is counting the order date. So every time this order date, which is Shopify, hold on. How do I see that exactly? From the Shopify orders maybe? I think it’s from here actually. From- Which I pulled from orders, but formatted. Which sheet do you know? I believe it’s copy. I believe it’s copy of Shopify. Oh, copy of Shopify. Okay. Yeah. Got it. Yeah. So if we just do equals count if that comma. Okay. Oddly, the first one’s- The first one is different. Don’t know what to make of that. Okay. But yeah, what if we tried dividing that by that, but we replace that with order date? Aha! Ah! Getting closer. Okay. So, Aha! Ah! Getting closer. All but that one strange one. That’s pretty good. Yeah. Why is it? That’s weird. All right. Let’s figure out what’s going on there. Too many tabs open. Let’s put a filter on there real quick. What date is that? 8-29-2023. 8-29. So the correct answer should be, it looks like 8-1-2. No, that’s 16. Yeah. It should be 16. For 8-29? Yeah. If you flip over to copy of Shopify, I’ve got it filtered there and it shows up 16 times. Okay. Okay. So, the other was wrong. For some reason, that first count is wrong, but none of the others, which I don’t know what to do with that. Well, at least it’s better now. It’s improved. Yeah. That’s wild. That’s very strange. What if we change that to just regular count instead of count A? It doesn’t matter. All right. Well, that’s a mystery. What is count A? I thought I’d needed to use that. Count A is for, is the difference between count and count A? I think it’s counting the number of, I think you can use count A for counting anything, whereas count is just for, I’m not sure. Okay. Well, it’s not really that. I was just kidding. Yeah. And switching it didn’t make any difference. So, that, I don’t know. That one’s another mystery. That’s very strange. Like, because having a mistake that propagated across all of the rows, that at least I would understand. Getting one wrong, I don’t know. Anyway, well, at least. Hey, that’s what I wanted. It’s perfect. That’s working. Okay, great. Well, it was a long and weird path, but I’m glad that at least. We got through together. All right, very good. Well, I’m still gonna spend some time investigating this on my own, figure out what’s going on, but all right, well, I hope that the rest of your day is less confusing. Thank you very much. All right, thanks. Yep, bye. Bye. Bye.