Fix Excel COUNTIFS Ranges That Do Not Expand After Data Refresh
Question details
Make Excel COUNTIFS criteria ranges remain the same size when external data is refreshed.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A COUNTIFS formula counts rows in an external data range that can grow after a refresh.
- Observed behavior
- One criteria range expands after refresh while another stays fixed, causing a #VALUE! error.
Check which columns contain each criterion and confirm that the values to be compared appear on the same rows. Select the COUNTIFS formula and compare the size of each criteria range.
Use Excel Table references for automatically expanding ranges
Use structured references when the refreshed data is loaded into an Excel Table.
Click a cell in the refreshed data. If it is not already an Excel Table, select the data and choose Insert > Table, then confirm the header setting.
Select the table and open Table Design to find its name. Note the column headers corresponding to the two criteria.
In the formula cell, use references to columns in the same table, such as =COUNTIFS(Table1[Status],"TestPass",Table1[Flag],"yes"). Replace the table name and headers with your own.
Choose Data > Refresh All, then check that the new rows appear inside the table and that the COUNTIFS result updates without an error.

Use matching whole-column references in COUNTIFS
Use whole columns for a quick fix when both criteria are in the same worksheet.
Use matching COUNTIFS ranges in WPS Spreadsheets
Open your workbook in WPS Spreadsheets and use matching whole-column references to count rows without a range-size mismatch.
- 1. Open the workbook: In WPS Spreadsheets, choose Open and select your Excel workbook.
- 2. Locate the criteria columns: Check the column letters containing the values you want COUNTIFS to compare on each row.
- 3. Enter matching ranges: Select the result cell and enter =COUNTIFS(F:F,"TestPass",A:A,"yes"), replacing the columns and criteria as needed.
- 4. Check the result: Press Enter and confirm that the formula returns a count rather than a range-size error.

Frequently Asked Questions
Why does COUNTIFS return #VALUE! after a refresh?
COUNTIFS requires all criteria ranges to have the same dimensions. If a refresh expands one range but not another, edit the formula so the ranges cover matching rows and columns.
Do Excel Table references expand when new data is refreshed?
Structured references expand when new rows are added to the referenced table. Make sure the data connection or query loads refreshed rows into that table, then use references such as Table1[Status].
Can I mix a whole-column reference with a fixed range?
No. A formula such as COUNTIFS(F:F,"TestPass",A2:A100,"yes") uses ranges of different sizes and can return #VALUE!. Use matching whole columns or equally sized ranges.
Will whole-column references count data outside the refreshed range?
They can. References such as F:F and A:A include the entire columns, so matching values elsewhere in those columns may also be counted. Use table references to limit the formula to the table's data.




