The SUMPRODUCT function is powerful, versatile and expansive. It is the go to function when looking for an alternative to array formulas.

If you are a newbie – check out our SUMPRODUCT function guide to get an understanding of how it works.

**Ok, are you ready to rock on with these 5 awesome SUMPRODUCT examples?**

Let’s do this.

If you prefer to watch videos, check out this video covering the tutorials from this blog post.

In the first example, we will use the SUMPRODUCT function to return the count and sum of the values from a specific month.

In this example the formula below has been entered into cell E3 to count the values for the month specified in cell D3.

=SUMPRODUCT(--(MONTH($A$2:$A$12)=$D$3))

The MONTH function has been used to extract the month from the each date in the range. This is then tested to see if it is equal to the month we want to count.

The double hyphens ‘–‘ are used to convert the true and false responses of this logical test to 1 and 0. The SUMPRODUCT then sums these 1’s and 0’s to return the answer.

The formula below has then be entered into cell F3 to return the total sales value for that month.

=SUMPRODUCT(--(MONTH($A$2:$A$12)=$D$3),B2:B12)

For this we just needed to add a comma and then the range of cells containing the sales values.

This works because the SUMPRODUCT function multiplies the 1’s and 0’s from month test by these sales values. And then these results are all summed.

This example can be very useful if you have to analyse comments, feedback or SEO keyword data. In these situations you will have large volumes of text and you may be looking for the occurrence of specific words.

In this example, the SUMPRODUCT formula has been used in cell D2 to count all the occurrences of words entered in cell C2.

=SUMPRODUCT(--(ISNUMBER(FIND(C2,A2:A9))))

In this formula the FIND function searches for the words in each cell. If the words are found then FIND returns its starting position, and if not it returns and error value.

The ISNUMBER function will then return true if a number is returned, or false if not. The double hyphens are then used just like the previous example to convert the true and false to 1 and 0.

The 1’s and 0’s are then summed by SUMPRODUCT to return the final count.

The SUMPRODUCT function can also be used to perform a unique count of values in a range.

Being able to count how many orders and how many training sessions is great. But sometimes you need to know how many different customers placed orders, and how many different training sessions. Then you need a unique count.

The formula below performs a unique count on range A2:A10.

=SUMPRODUCT(1/COUNTIF(A2:A10,A2:A10))

For this to work the COUNTIF function counts the occurrences for each name in the list producing the below. This says that Robert occurs twice, James once and Sally three times etc.

=SUMPRODUCT(1/{2;1;3;2;1;1;3;1;3})

These values are then divided by the 1 producing the below.

=SUMPRODUCT({0.5;1;0.33;0.5;1;1;0.33;1;0.33})

And then SUMPRODUCT sums them all up delivering the unique count.

How about summing only the top values from a range. Yes SUMPRODUCT can do this.

In this example we sum only the top 3 values, but this can easily be adapted to top 5, top 10 or whatever you wish.

The formula below sums only the top 3 values in range B2:B12.

=SUMPRODUCT(LARGE(B2:B12,{1,2,3}))

This formula uses the LARGE function with SUMPRODUCT. The LARGE function is used to return kth largest value in a data set, such as the 5th largest.

In this example we have provided the LARGE function with an array of {1, 2, 3} so that it returns the top 3. The SUMPRODUCT then sums them.

This is all in the beauty of the SUMPRODUCT formula handling arrays of data.

If you need to sum the values from the bottom of the range you can use the SMALL function.

In the final example we see the SUMPRODUCT formula performing a two way lookup.

You may have created two way lookups before in the past. The most common way to do this is to use the INDEX and MATCH function combination.

The formula below performs a two way lookup. It looks for the value of cell B1 down column A, and the value in cell D1 along row 3. It returns the value at the intersection, which in the image is £246.

=SUMPRODUCT((A4:A13=B1)*(A3:M3=D1),A4:M13)

The asterisk (*) is used as an AND operator in this formula. And the second array is the range to return the value from i.e. A4:M13.

The SUMPRODUCT function is so incredibly versatile we could be listing far more examples in this tutorial. For example it can also sum the values from every nth row of a list.

What have you used it for?

- Use the MID and FIND functions to extract text
- 5 awesome uses of the INDIRECT function
- 4 amazing uses of CONCATENATE
- How to use the TEXT function of Excel

]]>

The group league tables are ranked as the results are entered. As soon as a groups fixtures have been completed, the knockout schedule is created. The quarters, semi-final and final fixtures are then calculated as these results are entered.

The spreadsheet is unlocked so you are free to check out the formulas and how it all works. Download the Euro 2016 planner spreadsheet.

There are many formulas and techniques used to create this Euro 2016 planner. They include;

**The SUMPRODUCT function** – This has been used heavily to perform the calculations at the group stages. I thought it was the best function to handle the calculation of a team’s games played, number of wins, goals scored etc. Learn more about the SUMPRODUCT function.

**Ranking and then calculating unique ranking** – The rankings for the group stages are done on the *Calculations* sheet (you will need to unhide it). On here I needed to calculate a teams ranking based on points, then goal difference and then goals scored. If a ranking was still tied, a unique ranking was formulated.

**Nested IF’s** – These have been used in the knockout stages to organise the fixtures as the results are entered.

**The VLOOKUP function** – It was guaranteed to be used somewhere. It has been used on the *League Tables* sheet (another hidden sheet) to formulate the group tables from the workings on the *Calculations* sheet. It is also used to help calculate the third place teams permutations (explained later in this post). Learn more about VLOOKUP.

**The Excel Camera tool** – A brilliant little tool. Used to create a dynamic picture of the group tables from the *League Tables* sheet onto the *Group Stages* sheet. Find out more about the Excel Camera tool.

These skills and techniques are all shown in detail in my online course for creating your own sports league tables and tournaments in Excel. Join hundreds of others in learning these skills. I will be on hand to help with any queries.

The UEFA European Championships 2016 has a new format for some of the fixtures in the last 16 (the first knockout round). The top 2 teams in each of the 6 groups are automatically through. They are then followed by the 4 best third place finishers.

A ranking is given to each of the teams who finish third in their group. The four best teams’ progress. Who they play in the next round is determined by the table below.

For example, the table above shows that if the 4 best third place teams are from groups A, B, C and D, then the winner of group A would play the third best team in group C. But if the 4 best third place teams are from groups A, B, D and E, then the winner of group A would play the third best team in group D.

This made things a little complicated to calculate which team progresses and who they will play in the last 16. On the *League Tables* sheet you can see a league table for the third place teams. The four best groups are calculated and the table below is formulated.

On the *Knockout Stages* sheet a VLOOKUP function is then used to return the correct team from this table.

This article looks at 4 advanced techniques for summing values including;

- Summing a range that contains errors
- Creating a cumulative total
- A consolidated sum from multiple sheets
- Summing Every Nth Value in a Range

If the range of values you wish to sum contain an error, your SUM function will also return an error.

The AGGREGATE function released in Excel 2010 enables you to ignore error values when summing.

This function is very versatile and can also be used to calculate other aggregates such as the count, average or max values in a range. As well as ignoring errors, it can also be used to ignore hidden rows and subtotals in a range.

The image below shows the AGGREGATE function being used to sum a range of cells containing error values. In the formula, the number 9 specifies the use of Sum, and the number 6 specifies to ignore error values only.

View the video below for a complete explanation of the AGGREGATE function.

You may want to create a cumulative total, or running total, on your spreadsheet to add the values onto the previous value.

This cumulative total can be created with a simple formula as shown below.

This image shows a running total for the months of the year. The formula starts in cell C3 and has been exposed in the image to show its inner makings. This formula has been copied to cells C4:C13.

You may have values on multiple sheets that need summing. For example, these sheets may represent different months of the year, different regions or maybe different promotions that are running.

Let’s imagine the cell containing the value is in the same position on each sheet. For example, in cell B10. And the sheets you are using are grouped together and not separated by any other sheets.

You can write a SUM function to consolidate all of these values by;

- Begin typing the formula
*=SUM(* - Click on the first sheet of the range of sheets you want to use.
- Hold the Shift key on the keyboard and click on the last sheet in the range.
- Click on the cell containing the value one each sheet.

The end result will be something like below. In this example, *January* is the first sheet and *December* in the last sheet in the range.

=SUM(January:December!B4)

You could also just type this formula rather than follow the steps listed above.

It could be that the values you wish to sum are not in consecutive cells. Take the image below for instance where the values to be added are in every 5^{th} cell.

For this complex task we need the SUMPRODUCT function. This powerful function can handle complex criteria when adding or counting values (learn more about the SUMPRODUCT function).

The formula below is used to sum the values from every 5^{th} cell as in the example above.

=SUMPRODUCT((MOD(ROW($B$3:$B$22)-2,5)=0)*($B$3:$B$22))

The ROW function is used to return the row number of the current value. 2 is subtracted from this row number because in this example the list starts from row 3, so the 5^{th} row is row 7. So the value to add is always 2 cells above the multiples of 5 (5, 10, 15, 20).

The MOD function is used to divide the row number by 5 to determine if it is the 5^{th} cell. MOD will result in 0 if it is the 5^{th} row so SUMPRODUCT tests if it is equal to 0.

SUMPRODUCT then multiplies the result (which will be 1 if true) with the list of values. This is then totalled.

This is a complex formula so for a more complete understanding watch the video below.

]]>This post looks at using a formula to calculate this distinct count.

Consider the list below of a list of delegates attending our courses. A normal count on this range will tell us how many attendances there were. That’s good, but we want to know how many unique attendees there were.

If you have not been introduced to the amazing world of the SUMPRODUCT function before then you are in for a treat. This function comes to our rescue on so many occasions.

The image below shows the formula to count the number of different delegates that attended.

The answer appears as 4. There are 4 different delegates (Mickey Mouse, Bill Ding, Belle Jinwaffles and Minnie Mouse).

**Explanation**

Ok, let’s try and explain what is going on here.

The COUNTIF function produces the result below;

{3;2;1;3;1;3;2}

This is because Bill Ding appears 3 times, Belle Jinwaffles twice, then Mickey Mouse once etc. So it is counting how many times each different delegate attended.

These figures are then divided by 1 so that when summed together we are adding 1 for each delegate. The array below is summed.

{0.33;0.5;1;0.33;1;0.33;0.5}

Not the easiest formula to get your head around. Most importantly it works. An understanding can come with time if it seems tricky right now.

Spaces in the range will cause the *#DIV/0!* error to appear.

The formula can be adapted to ignore any spaces in the range.

]]>The spreadsheet below contains totals in every fifth row starting from row 3. We want to only add these sales totals.

The formula below is entered in cell E1.

Let’s break the formula down a little.

**ROW**: The ROW function is used to return the row number that the formula is checking. -2 has been entered on the end because the values begin from row 3. This -2 ensures that instead of using rows 7, 12, 17 and 22. Rows 5, 10, 15 and 20 are used.

**MOD**: The MOD function used to find the remainder after a number is divided by a divisor. It is used in this formula to check whether it is the fifth row or not. If it is the fifth row, after dividing the row number by five, the result will be 0.

Note: The MOD Function used in Excel VBA to check if a number is even.

**SUMPRODUCT**: The SUMPRODUCT function will perform the summing. The first array is the test for the row. This is what is returned;

{0;0;0;0;1;0;0;0;0;1;0;0;0;0;1;0;0;0;0;1}

The 1 is returned when the condition is true. This is multiplied by the range of values and then summed which gives us our total.

Note: See the SUMPRODUCT function used to count values based on multiple conditions.

I hope this explanation makes sense and you are able to adapt it for your own situation. If not, please check out this video.

Sum Every Nth Row in a List – Microsoft Excel Tips and Tricks

The SUMPRODUCT function is used to multiply the values of multiple arrays and then sum the totals. However it is capable of so much more amazing feats. It truly is one of those hidden gems waiting to be discovered.

In this example the SUMPRODUCT function is being used to count the number of orders in the list shown below.

This list has been formatted as a table providing many benefits. One of the benefits is the ease of referencing the necessary columns within a formula (Find out more about tables in Excel).

To use the SUMPRODUCT function to count records we will enter it as below.

=SUMPRODUCT((condition 1)*(condition 2)*(condition 3))

Each condition, or array, is enclosed within its own set of brackets. The multiplication operator (*) is used to apply the AND logic between each condition.

For example, the formula below will count all the orders by the salesperson Peacock (J9), and for the product Tofu (K9).

An area where SUMPRODUCT demonstrates its flexibility over alternatives such as COUNTIFS, is its ability to handle OR logic between conditions.

If we want to count all the orders by the salesperson Peacock (J9), and also the Salesperson Taylor (J10) we could enter the formula below. The Plus operator (+) has been used to create the OR logic between conditions.

The SUMPRODUCT function can handle many more conditions if necessary. When you get to grips with it you will feel like no data analysis is out of your reach.

This required matching records from different worksheets using multiple conditions. To check if they were a duplicate, the first name, last name and company fields needed to match.

To achieve this I wrote an array formula using the IF and SUMPRODUCT functions. This can be seen below testing the data from columns A, B and C across both sheets.

{=IF(SUMPRODUCT(((Sheet1!$A$2:$A$16000)=A2)*((Sheet1!$B$2:$B$16000)=B2)*((Sheet1!$C$2:$C$16000)=C2))=1,”Yes”,””)}

An array formula has curly braces at the ends which are added when you press Ctrl + Shift and Enter to run the formula.

The SUMPRODUCT formula returns true if you all three conditions match. THE IF function then displays the word Yes if there is a match on a record, and nothing if there is no match.

The column than then be filtered by blank cells to return all the missing records.

Find out more about the SUMPRODUCT function.

How would you have solved this problem? Drop me a comment with other formulas that could have achieved the same result.

]]>