MrExcel's Learn Excel #668 - Total Diagonally

If you like this content, please consider visiting the video on YouTube and subscribe to the MrExcel Channel to show your support!
This video has been published on Feb 20, 2009.
Today, we look at how to total a data set diagonally. Episode 668 shows you how.

This blog is the video podcast companion to the book, Learn Excel 97-2007 from MrExcel. Download a new two minute video every workday to learn one of the 377 tips from the book!
maxresdefault.jpg


Transcript of the video:
Welcome back to the MrExcel netcast. I'm Bill Jelen.
Well today we have a question sent in by Kambiz actually tomorrow, we're going to get to his question.
Today I just want to do some preliminary work on this.
One of my favorite statements and this came to me from a fellow named Eric that I used to work with.
Eric had a real wry sense of humor and he would talk about impossible request that managers would give.
Something like hey, can you take all those worksheets and total them diagonally for me.
Well you know that you have to laugh with that because that's something that's really hard to do, if you needed to go through and total the data set diagonally.
But it turns out that there is a formula that will total diagonally. I've got this from Chip Pearson.
If you don't know Chip, Chip is another MVP. A long time MVP, has a great website at CPEARSON.COM Chip wrote in to me one day and said.
Hey, you know, I saw that on your website, it turns out there's a formula.
That'll do that. Let's take a quick look at this formula. So it's an array formulas.
We had to use "Contro+Shift+Enter" Basically it says we're going to take the row of this entire range and see if it's equal to the column of the entire range.
And then multiply that by the range.
Now let me show you exactly how this works.
I'm going to go to another worksheet, where I set up each bit of that. In the first part, what is the row of the range.
So that just gives us the numbers 1 2 3 4 5.
What's the column of the range, well that gives us, basically the numbers 1 through 5 but going the other way, so everything in column A is 1, everything column C is 3, everything in column E is 5 and then the formula says. See if those two numbers are equal.
So here's an IF statement.
It says if the row number equals the column number then basically give us a 1 otherwise give us a 0.
And you'll see what that does is, it gives us 1's just along the diagonal of the Matrix.
And then here finally I've put our original numbers and the final result says take that array of zeros and ones and multiply it by the original numbers, so what we get then is just the numbers along the diagonal, the 30 the 50 the 29 the 40 and the 46.
Finally because we have a sum around the whole formula, sums it up. We get 195 We'll go back to the original formula here 195.
You'll see that It works if I would change one of these numbers.
44 and it does accurately work. Now Kambiz sent in a question I'll talk about that tomorrow because it's much more difficult, but it uses the exact same trick.
So thanks for stopping by. I will see you tomorrow, to figure out how we can create a more robust diagonal formula to solve Kambiz's problem.
 

Forum statistics

Threads
1,214,382
Messages
6,119,194
Members
448,874
Latest member
Lancelots

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top