Function Problems

How to Sum Invoice Line Items and Match to a Summary Sheet in Excel

Khadija KhanKhadija Khan Nov 2, 2026 868 views

Question details

The user needs a method to total sales rows corresponding to specific invoices from a sales worksheet and return the aggregated subtotal to a separate summary sheet.

How to Sum Invoice Line Items and Match Them to a Summary Sheet
Product
Spreadsheets
Device & OS
not provided
Scenario
Consolidating invoice data across multiple worksheets where detailed line items are recorded separately from the main invoice summary.
Observed behavior
The goal state is an automated summary sheet that accurately matches an invoice number to its detailed sales rows and outputs the total sum.
Before you start

Verify that your summary sheet and your detailed sales worksheet are contained within the same workbook, and ensure that the invoice numbers in both sheets are formatted identically (either both as text or both as numbers).

Solution 1Recommended

Use the SUMIF Function to Match and Total Invoice Items

The SUMIF function is the most efficient method to conditionally sum values from a detailed data sheet based on a specific criteria, such as an invoice number.

The SUMIF function evaluates a specified range for a certain condition and sums the corresponding values in another range. This prevents the need to manually add rows together.

1
Select the target cell

Open your summary worksheet (e.g., SalesSummary) and select the cell where you want the first subtotal to appear, such as cell D2.

2
Enter the SUMIF formula

Type the formula =SUMIF(Sales!B:B, B2, Sales!G:G) into the cell. In this formula, 'Sales!B:B' represents the column of invoice numbers in your detailed sheet, 'B2' is the invoice number you want to match on your summary sheet, and 'Sales!G:G' contains the monetary values to add up.

3
Apply the formula to other rows

Press Enter to calculate the first total. Click on the cell again, grab the small square fill handle at the bottom-right corner, and drag it down the column to apply the formula to the rest of your invoices.

Use the SUMIF Function to Match and Total Invoice Items
Formula Tip: Using entire column references like B:B and G:G ensures that any new sales rows added to the detailed sheet later will be automatically included in your sums without updating the formula.
Professional Spreadsheet Alternative

Easily Sum Invoice Data with WPS Spreadsheet

WPS Office offers a highly compatible and intuitive Spreadsheet application that effortlessly handles advanced formulas like SUMIF. Whether you are generating complex pivot tables or consolidating daily sales data, WPS helps you organize your finances seamlessly.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your invoice data and summary sheet.
  2. 2. Select the summary cell: Click on the cell in your Summary sheet where the total should be displayed.
  3. 3. Insert the SUMIF function: Type =SUMIF( or use the 'Insert Function' tool from the Formulas tab to find it.
  4. 4. Define your ranges: Highlight your criteria range, click the lookup value, highlight the sum range, and press Enter.
  5. 5. Fill down: Drag the fill handle downwards to automatically calculate the totals for the remaining invoices.
Fully compatible with Microsoft Excel formats (.xlsx, .xls, .csv).Built-in intelligent formula builder with real-time error checking.Lightweight architecture that processes massive data arrays without lag.Free and intuitive interface designed for fast and effective data analysis.
QA img-9

Frequently Asked Questions

Why is my SUMIF formula returning a zero when there is data?

This usually happens if the invoice numbers in your summary sheet do not exactly match the data types in your sales sheet. For example, one column might be formatted as 'Text' while the other is formatted as a 'Number'. Ensure both columns share the same data format.

Can I sum invoice line items based on multiple criteria?

Yes. If you need to match multiple conditions, such as summing line items for a specific invoice number and a specific date, you should use the SUMIFS function instead of SUMIF. SUMIFS allows you to define multiple criteria ranges.

How do I fix the #NAME? error in my sum formula?

The #NAME? error occurs if the function name is misspelled or if there is a typo in the sheet name referenced in your formula (for instance, typing 'Sale!B:B' instead of the actual sheet name 'Sales!B:B'). Double-check your spelling and syntax.