How can I sum by week in Google Sheets?

To sum by week in Google Sheets, you can use the WEEKNUM function to assign each date in your data set a week number. Then, you can use the SUMIF or SUMIFS function to add up all the values in a specific week. This will allow you to easily calculate the total for each week in your data set. Alternatively, you can use the PIVOT TABLE feature in Google Sheets and group your data by week to automatically calculate the sums for each week.


Often you may want to sum the values of some dataset in Google Sheets based on week.

The following step-by-step example shows how to do so.

Step 1: Enter the Data

First, enter the values for a dataset that show the total sales of some product on various dates:

Step 2: Extract the Week from Dates

Next, we will use the WEEKNUM function to extract the week from each date.

In our example, we’ll type the following formula in cell D2:

=WEEKNUM(A2)

We’ll then drag and fill this formula down to every remaining cell in column D:

Step 3: Find the Unique Weeks

Next, we need to use the UNIQUE function to produce a list of unique weeks.

In our example, we’ll type the following formula in cell E2:

=UNIQUE(D2:D12)

This will produce a list of unique weeks:

Step 4: Calculate the Sum by Week

Next, we will use the SUMIF(range, criterion, sum_range) function to find the sum of the sales made during each week.

In our example, we’ll type the following formula in cell F2:

=SUMIF($D$2:$D$12, E2, $B$2:$B$12)

We’ll then drag and fill this formula down to the remaining cells in column F:

From the output we can see

  • There were 22 total sales made in the first week of the year.
  • There were 24 total sales made in the second week of the year.
  • There were 63 total sales made in the third week of the year.

And so on.

Additional Resources

The following tutorials explain how to perform other common tasks in Google Sheets:

How to Calculate Year to Date Values in Google Sheets

x