Combine and Total Excel Rows by Ad Group
Question details
Combine advertising rows into one summary row per Ad Group and total the associated metrics.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains thousands of advertising records, with multiple rows for each Ad Group.
- Observed behavior
- The desired result is one row per Ad Group with totals for impressions, clicks, spend, and 7 Day Total Sales.
Check the source sheet name and identify the columns for Ad Group and each metric. The examples below assume the source is Sheet1, Ad Group is in column F, and the summary is on Sheet2.
Use SUMIF to total each metric by Ad Group
Use this method when you want a formula-based summary with one row for each Ad Group.
Copy the Ad Group values from Sheet1 column F and paste them into Sheet2 starting at A3. Select the pasted list, choose Data > Remove Duplicates, and remove any blank entries.
On Sheet2, enter headings for Impressions, Clicks, Spend, and 7 Day Total Sales in columns B through E.
In B3, enter =SUMIF(Sheet1!$F:$F,Sheet2!$A3,Sheet1!J:J) if column J contains impressions. Otherwise, replace J:J with the actual impressions column.
Enter similar SUMIF formulas in C3, D3, and E3. Replace Sheet1!J:J in each formula with the source column for Clicks, Spend, or 7 Day Total Sales, respectively.
Select B3:E3 and drag the fill handle down alongside the Ad Group list. Check a few totals against the source rows.

Create a PivotTable grouped by Ad Group
Use a PivotTable to summarize all four metrics without writing separate formulas.
Total Ad Group metrics in WPS Spreadsheets
Use SUMIF in WPS Spreadsheets to create a one-row-per-Ad Group summary of impressions, clicks, spend, and sales.
- 1. Open the workbook: Open your Excel workbook in WPS Spreadsheets and check the source columns for Ad Group and the metrics.
- 2. Make a unique group list: Copy the Ad Group values to a summary sheet starting at A3. Select the pasted list and choose Data > Remove Duplicates.
- 3. Enter a SUMIF formula: In B3, enter =SUMIF(Sheet1!$F:$F,Sheet2!$A3,Sheet1!J:J), replacing the sheet names and columns if they differ in your workbook.
- 4. Calculate the remaining metrics: Enter formulas in the adjacent columns using the source column for each metric, then select the formulas and drag the fill handle down the group list.
- 5. Save the summary: Check the totals, then choose File > Save As and select an Excel format such as XLSX.

Frequently Asked Questions
What does the SUMIF formula use to match an Ad Group?
In =SUMIF(Sheet1!$F:$F,Sheet2!$A3,Sheet1!J:J), column F contains the source Ad Group values, A3 contains the group to match, and column J contains the values to total.
How do I sum clicks and spend instead of the values in column J?
Use the same SUMIF formula and replace Sheet1!J:J with the source column for Clicks or Spend. Put each formula under its corresponding summary heading.
Why does my PivotTable show a count instead of a sum?
Open the metric's Value Field Settings in the PivotTable and select Sum. If Sum is unavailable or results are unexpected, check that the source metric values are stored as numbers.
Will new Ad Groups appear automatically in a SUMIF summary?
SUMIF updates totals for groups already listed, but it does not create new group names. Copy or add new Ad Groups to the summary list and fill the formulas down.




