Use COUNTIF and INDIRECT to Count Multiple External Ranges in Excel
Question details
Count matching account names across several external ranges without joining the range references with TEXTJOIN.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Range addresses are stored in a table column, and each account name needs a combined count across those ranges.
- Observed behavior
- The desired result is one total count for each account name across the referenced ranges.
Open every source workbook referenced by INDIRECT. Check that Table1 contains columns named Range addresses and Values to count, and that each address is a valid external range reference stored as text.
Sum COUNTIF results from the listed range addresses
Use this formula to count an account name across the ranges listed in a table without TEXTJOIN.
INDIRECT turns each address into a range reference, COUNTIF counts matches in each range, and SUM adds the counts. Array handling can vary by Excel version, so test the formula with known counts.
In Table1[Range addresses], enter one valid external range address per row, such as '[Accounts.xlsx]Sheet1'!$A$2:$A$100.
In a result cell on the row containing the account name, enter =SUM(COUNTIF(INDIRECT(Table1[Range addresses]),[@[Values to count]])) and press Enter.
Compare the result with counts from the individual source ranges. If Excel returns an error, check the addresses and confirm that all referenced workbooks are open.

Consolidate account names with Power Query
Use this approach when you want a maintainable source table that can be refreshed from accessible workbooks without keeping them open.
Count Account Names Across Workbooks in WPS Spreadsheets
Use separate COUNTIF formulas in WPS Spreadsheets to count matches across selected external ranges and add the results, without joining range addresses.
- 1. Open the workbooks: Open the destination workbook and the source workbooks in WPS Spreadsheets.
- 2. Start the first count: Select a result cell and type =COUNTIF(. Switch to the first source workbook and select the account-name range.
- 3. Add the criterion and next range: Type a comma, select the cell containing the account name in the destination workbook, and type ). Then type +COUNTIF( and select the next source range.
- 4. Complete and check the formula: Add the same account-name criterion and close the parenthesis. Repeat for any other ranges, press Enter, and compare the total with known matches.

Frequently Asked Questions
Do I need TEXTJOIN to combine the range addresses?
No. The formula passes Table1[Range addresses] directly to INDIRECT, then uses SUM to combine the COUNTIF results.
Why does INDIRECT return an error for an external workbook?
In Excel, INDIRECT cannot resolve a reference to a closed external workbook. Open the source workbook and check that the stored workbook, sheet, and range address are correct.
What do I do if my table or column names are different?
Replace Table1[Range addresses] with your table and address-column names, and replace [@[Values to count]] with the current-row reference to your account-name column.
Can I count the data without opening the source workbooks each time?
You can import and append accessible source data with Data > Get Data in Excel, load it to a table, and count against that table. Use Data > Refresh All when you need updated results.




