Function Problems

Use COUNTIF and INDIRECT to Count Multiple External Ranges in Excel

Bushra ParveenBushra Parveen Dec 2, 2026 868 views

Question details

Count matching account names across several external ranges without joining the range references with TEXTJOIN.

Count Multiple External Ranges with COUNTIF and INDIRECT in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Check the address column

In Table1[Range addresses], enter one valid external range address per row, such as '[Accounts.xlsx]Sheet1'!$A$2:$A$100.

2
Enter the formula

In a result cell on the row containing the account name, enter =SUM(COUNTIF(INDIRECT(Table1[Range addresses]),[@[Values to count]])) and press Enter.

3
Verify the total

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.

Sum COUNTIF results from the listed range addresses
Keep source workbooks open: INDIRECT cannot resolve references to closed external workbooks in Excel.
WPS Spreadsheets

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. 1. Open the workbooks: Open the destination workbook and the source workbooks in WPS Spreadsheets.
  2. 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. 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. 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.
Count matching account names across multiple rangesOpen and edit Microsoft Excel XLSX and XLS filesWork with familiar spreadsheet formulas and menusUse WPS Office for free
microsoft office alternative - wps office

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.