Sum Ifs By Week Number – Excel & Google Sheets

This tutorial will demonstrate how to sum data corresponding to specific week numbers in Excel and Google Sheets.

sum if week number Main Function

Sum If by Week Number

To “sum if” by week number, we will use the SUMIFS Function. But first we need to add a helper column containing the WEEKNUM Function.

The Week Number helper column is calculated using the WEEKNUM Function:

Adding WEEKNUM Helper Column

Next, we will use the SUMIFS Function to sum all Sales that take place in a specific Week Number.

Adding WEEKNUM Helper Column 1

Sum If by Week Number – Without Helper Column

The helper column method is easy to follow, but you can also replicate the calculation in a single formula using the SUMPRODUCT Function in combination with the WEEKNUM Function to sum the Total Number of Sales by Week Number.

SUMPRODUCT by Week Number

In this example, we can use the SUMPRODUCT Function to perform complicated “sum if” calculations. Let’s walk through the above example.

This is our final formula:

First, the SUMPRODUCT Function lists the array of values from the cell ranges:

Then, the WEEKNUM Function calculates the Week Number of each of the Sales Dates.

The WEEKNUM Function is not designed to work with array values, so we must add zero (“+0”) for WEEKNUM to process the values properly.

Week Number values equal to 1 are changed to TRUE values.

Next the double dashes (–) convert the TRUE and FALSE values into 1s and 0s:

The SUMPRODUCT Function then multiplies each pair of entries in the arrays to produce an array of Number of Sales that have a Week Number of 1:

Finally, the numbers in the array are summed together:

This formula is then repeated for the other possible values of Week Number.

More details about using Boolean statements and the “–” command in a SUMPRODUCT Function can be found here.

Locking Cell References

To make our formulas easier to read, we’ve shown the formulas without locked cell references:

But these formulas will not work properly when copy and pasted elsewhere in your file. Instead, you should use locked cell references like this:

Read our article on Locking Cell References to learn more.

Sum If by Week Number in Google Sheets

These formulas work exactly the same in Google Sheets as in Excel.

However, the WEEKNUM Function is more flexible in Google Sheets than in Excel, and accepts array inputs and outputs. Therefore the {Array}+0 operation in the WEEKNUM(B3:B9+0,1) formula is not required.

The full SUMPRODUCT formula can be written in Google Sheets as:

sum if week number Google Function

 

 

 

 

 

Excel Practice Worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!