Join Bob Flisser for an in-depth discussion in this video Preventing errors using absolute references, part of Excel 2010 Essential Training.
We've added numbers across. We've added numbers down. We did some more statistical information down there on the lower rows, but there's something else here that we really want to do. And let's take a look here. We have a grand total for all of the trips that we took in the first quarter. And we also have the total of each individual trip. Kind of think of a pie chart. If you're going to do a pie chart, and you want to know how much did each of the cities contribute to the grand total, you'd come out with a percent. So that's what we want to figure out here in Column F, is what percentage did each city contribute to our total expense for all of our travel? So let's go here to F5 and just type Percent or maybe Percent of Total.
And if you want, you can take Column F and stretch it out. When you get that two headed arrow you could double-click and stretch that out. Well this is simple division, but things could go a little haywire. And I'm going to do this in two ways. First, we're going to do it the wrong way. You'll see there's a problem. Once we identify the problem, we'll delete it. We'll go back and do it the right way. So let's start here in Cell F6. And we're going to say Equals. And we want to take the total for the first city for San Francisco, divide, so you type a forward slash and divide by what? Well, divide by the grand total.
So we have E6/E14, the total of San Francisco divided by the grand total for all the travel. And just press Enter. And we could see that San Francisco contributed to about 15% of all our travel. First thing we want to do though is let's fix it. Rather than making it 0.14 or some horrible number, let's make it look like percentages. So we could simply select all of these cells here from San Francisco down to the Total. And to make it look like percentages, we want to be on the Home tab and over here in the Number section, click this Percent and that will make it percent style.
So we can see it's 15%. Now maybe you want some decimals in there. So over here you have these two little buttons here, and if you click this one, this will increase the decimals that it displays and if you click this button here next to it, it'll decrease the decimals that display. Keep in mind this is not actually rounding the numbers off. This is just formatting. Excel is still calculating based on that whole long number. Okay, that's great. So we see it's about 14.9%. Now here's where things can go a little haywire. You figure okay, great.
I don't have to do this for every single row. I can just take my Auto Fill and I'll drag down here to the total, hoping that I'll get 100%. Look at this. What we have is 100% garbage. Why is that? Well, let's click the first number we did, okay E6/E14, total of San Fran divided by the grand total. That's great. What's happening here? Here this is E7, the Los Angeles total. That's great. Divided by the average. Now it's kind of meaningless. And over here we have the Philadelphia total, E8/E16.
Again, meaningless. Now by time we get down here, we've got these divided by zero errors. So what's happening is when we took that Auto Fill and we dragged down, remember these were relative references. And Excel rewrote the formula for us the way it was designed to do. Changing the numerator, changing the denominator, and maybe let's press Ctrl+Tilde and we can see this a little more clearly. So it changes E6 to E7 to E8 to E9. That's great. But the denominator, it's changing E14 to E15, E16-- well it doesn't make a lot of sense.
What we want to do is we want to find someway that when we Auto Fill down at the column, the numerator changes from E6 to 7, 8, 9 but denominator stays fixed on 14. I'll just press Ctrl+Tilde, so we get back. Well, let's just delete all the stuff. Select those cells and delete. Let's go back here to F6. Now that we see what the problem is, let's go and do it the right way. It's going to be just a slight difference. So we type Equals, again the San Fran total, use the forward slash divided by the grand total there.
But don't enter it yet. Press the F4 key on your keyboard. When you press F4, you notice that it changes the denominator because that's where the cursor is from E14 to $E$14. This is an absolute reference. How is it an absolute reference? Well $E means stay fixed on Column E. $14 means stay fixed on Row 14, which is just another way of saying stay fixed on Cell E14. Well press the F4 key again and notice this changes a little bit to E$14.
So it's plain E, meaning that Excel can wear off Column E if necessary but still fixed on Row 14. Press F4 again. That's just kind of the reverse. Now we have $E14. $E meaning we're fixed on Column E, 14 meaning, well, it can veer off. Press F4 again, and it cycles back to the beginning. This is a purely relative reference. One last time press the F4 key. Normally you don't have to go through all this. I just wanted you to see what the options are. So we have E6/$E$14.
Now press Ctrl+Enter, and now get your Auto Fill handle and fill down to Row 14. Now we have some numbers that make sense. And this here, of course, we're diving 0 by the number. So we can just delete that. Well, press Ctrl+Tilde and let's take a look at what we have here. So our numerator changes E6 to E7 to E8. That's the way it did before. That's the way we want it and now because we have $E$14, those dollar signs make the Column E and the Row 14 fixed and when we get down to the last one, of course the number divided by itself is 100%.
So that is what an absolute reference is. If you've never seen this before, I know it might be a little confusing but absolute references are absolutely necessary because Excel uses them in many different places and we'll see them later in this course.
- Copying and pasting techniques
- Working with formulas and functions
- Dealing with formula errors
- Creating lookup tables
- Naming cell ranges
- Formatting data and worksheets
- Finding and replacing data
- Creating SmartArt diagrams
- Creating charts and PivotTables
- Recording macros
- Sharing workbooks