To sum values across multiple sheets in Excel, use the SUMIF function with a 3D reference: =SUMIF(Sheet1:Sheet3!A:A, criteria, Sheet1:Sheet3!B:B). This sums the values in column B for rows where column A matches the criteria across all sheets in the range. If your sheets are not in a contiguous range, use SUMPRODUCT with SUMIF for each sheet, or VSTACK (Microsoft 365) to combine the data first.
Why a Simple SUMIF Doesn’t Work Across Sheets
The standard SUMIF function in Excel is designed to work on a single contiguous range of cells. When you try to reference multiple sheets with a normal range like Sheet1!A1:A10, Excel only evaluates the first sheet. The 3D reference syntax Sheet1:Sheet3!A1:A10 is the key to making SUMIF work across sheets, but it has a critical limitation: it only works with the SUM, AVERAGE, COUNT, MIN, and MAX functions. SUMIF is not in that list, so you cannot use a 3D reference directly inside SUMIF.
How to Use SUMIF Across Multiple Sheets (Step-by-Step)
Because SUMIF doesn’t accept 3D references, you have two main approaches. The first is to use multiple SUMIF functions added together. The second is to combine the data into one range using VSTACK (available in Excel 365 and Excel 2024).
Method 1: Adding Multiple SUMIFs (Works in All Versions)
Assume you have three sheets named Jan, Feb, and Mar. Each sheet has the same layout: column A contains product names (A2:A20) and column B contains sales amounts (B2:B20). To sum all sales for “Product X” across the three sheets, use:
=SUMIF(Jan!A2:A20, "Product X", Jan!B2:B20) + SUMIF(Feb!A2:A20, "Product X", Feb!B2:B20) + SUMIF(Mar!A2:A20, "Product X", Mar!B2:B20)
This formula returns the total. For example, if Jan has 100, Feb has 150, and Mar has 75, the result is 325.
If you have many sheets, you can shorten the formula using SUMPRODUCT and SUMIF together with a list of sheet names. Suppose you have sheet names in cells E1:E3. Then use:
=SUMPRODUCT(SUMIF(INDIRECT("'" & E1:E3 & "'!A2:A20"), "Product X", INDIRECT("'" & E1:E3 & "'!B2:B20")))
This works because INDIRECT converts the text in E1:E3 into actual references, and SUMPRODUCT sums the array of results. Note: INDIRECT is volatile, so it recalculates every time Excel changes something.
Method 2: Using VSTACK (Microsoft 365 and Excel 2024)
If you have Excel 365 or Excel 2024, you can stack all the data from multiple sheets into a single range using VSTACK, then apply a simple SUMIF. For example, to combine data from Jan, Feb, and Mar sheets (assuming identical columns A and B):
=SUMIF(VSTACK(Jan!A2:A20, Feb!A2:A20, Mar!A2:A20), "Product X", VSTACK(Jan!B2:B20, Feb!B2:B20, Mar!B2:B20))
This formula creates a virtual array of all A values and all B values, then SUMIF works on that combined array. It’s cleaner than adding multiple SUMIFs, but only works in Excel 365/2024.
Choosing the Right Method for Your Situation
Which method you choose depends on your Excel version and the structure of your data.
- All Excel versions: Use the multiple SUMIF addition method, or the SUMPRODUCT+INDIRECT method if you have many sheets.
- Excel 365/2024: Use VSTACK for simplicity and better performance (INDIRECT is slow with many sheets).
- Non-contiguous sheets: If your sheets are not next to each other (e.g., Sheet1, Sheet5, Sheet12), you cannot use a 3D reference. Use VSTACK or list the sheet names explicitly.
- Different layouts: If sheets have different column positions, VSTACK won’t work directly; you’ll need to adjust each range manually.
Common Problems and How to Fix Them
Here are typical issues you might run into:
- #VALUE! error: This often happens with SUMPRODUCT+INDIRECT if the sheet names in cells don’t match exactly, or if the ranges are not the same size. Double-check spelling and ensure all ranges have the same number of rows.
- Wrong results when sheets have different row counts: If one sheet has data in A2:A20 and another has data in A2:A25, using A2:A20 in all SUMIFs will miss rows 21-25. Use full column references (e.g., A:A) to avoid this, but be aware that full column references can slow down calculations.
- Sheet names with spaces: When using INDIRECT, you must wrap the sheet name in single quotes:
INDIRECT("'" & E1 & "'!A:A"). For VSTACK, you don’t need quotes, but you must include the sheet name as is. - Hidden sheets: SUMIF includes hidden sheets by default. If you want to exclude hidden sheets, you’ll need a more complex formula or VBA.
Comparing SUMIF Across Sheets to Other Functions
Besides SUMIF, you might consider these alternatives:
- SUMIFS: Use this if you have multiple criteria. The syntax is similar, but you can add more criteria pairs. For example,
=SUMIFS(Jan!B:B, Jan!A:A, "Product X", Jan!C:C, "North"). - SUMPRODUCT: This can sum with multiple conditions across sheets without VSTACK, but the formula becomes long and less readable.
- Power Query: If you have many sheets and need to combine them regularly, Power Query (Get & Transform Data) can merge all sheets into one table, then you can use a pivot table or SUMIF on the combined data. This is a more robust solution for large datasets.
- Consolidate feature: Excel’s Consolidate tool (Data > Data Tools > Consolidate) can sum data from multiple sheets, but it only works with identical layouts and creates a static result.
Performance and Accuracy Tips
When working with multiple sheets, keep these points in mind:
- Avoid full column references in SUMPRODUCT+INDIRECT: Using A:A in INDIRECT can cause performance issues because INDIRECT is volatile and recalculates often. Limit ranges to the actual data.
- Use VSTACK for better performance: VSTACK is non-volatile and generally faster than INDIRECT.
- Check for text vs. numbers: If your criteria column contains numbers stored as text, SUMIF won’t match. Use
TEXTorVALUEfunctions to normalize. - Be consistent with criteria: SUMIF is not case-sensitive, but it does match exact text. If you have trailing spaces, use
TRIM.
Frequently Asked Questions
Can I use a 3D reference with SUMIF?
No, SUMIF does not accept 3D references like Sheet1:Sheet3!A:A. Only SUM, AVERAGE, COUNT, MIN, and MAX support 3D references. For SUMIF, you must use one of the methods above.
How do I sum across all sheets in a workbook except the summary sheet?
You can list all sheet names except the summary sheet in a range, then use the SUMPRODUCT+INDIRECT method. Alternatively, use VSTACK with explicit sheet references. There is no built-in “all sheets except this one” reference.
What if my sheets have different column layouts?
If the columns are not in the same position, you cannot use VSTACK directly. You’ll need to adjust each SUMIF range to point to the correct columns on each sheet. For example, =SUMIF(Sheet1!A:A, crit, Sheet1!C:C) + SUMIF(Sheet2!B:B, crit, Sheet2!D:D).
Does SUMIF work with sheets that are hidden?
Yes, SUMIF will include hidden sheets in the calculation. If you need to exclude them, you’ll need a VBA macro or a more complex array formula that checks visibility.
Can I use wildcards in the criteria across sheets?
Yes, you can use wildcards like * and ? in the criteria, just as you would in a single-sheet SUMIF. For example, "Prod*" matches any text starting with “Prod”.
Is there a way to sum across sheets without typing each sheet name?
Yes, you can use the SUMPRODUCT+INDIRECT method with a list of sheet names in cells. Or, if you have Excel 365, you can use a dynamic array formula with VSTACK and a list of sheet names, but that requires advanced LET or LAMBDA functions.
Related
- Data Entry in Computer: What It Is & How It Works
- Count in Sheets: Google Sheets COUNT Function Guide
- How to Generate Random Numbers in C++
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Excel VLOOKUP With Two Criteria: Formula and ExamplesYes. To use VLOOKUP with two criteria, combine the criteria into one helper key, then look up that…
- Excel Combine XLOOKUP with SUM: 2 WaysYes, you can combine XLOOKUP with SUM in Excel by nesting XLOOKUP inside SUM to sum a returned…
- Text Split in Excel: Methods, Formulas, and Common FixesTo split text in Excel, select the cells and choose Data > Text to Columns to separate values…
- VLOOKUP for 2 Values: How to Match on Two ColumnsTo look up a value based on two criteria in Excel, you cannot use a single VLOOKUP directly—VLOOKUP…
- Python String Functions: Methods, Examples, and UsesPython string functions are mainly string methods—operations such as upper(), strip(), replace(), and split() that work on text.…
- XLOOKUP Multiple Columns: How to Return or Match ThemTo look up multiple columns with XLOOKUP, you have two main goals: returning values from several columns at…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.