logo
search
Formula Errors

How to Fix COUNTIF #VALUE! Error with Linked OneDrive Workbooks in Excel

Maira MehtabMaira Mehtab Sep 22, 2026 869 views

Question details

The user needs to resolve a #VALUE! error that occurs when using the COUNTIF function to reference a linked external workbook stored in OneDrive or Microsoft Teams.

Product
Microsoft Excel
Device & OS
not provided
Scenario
Using the COUNTIF function to pull and count data from an external Excel workbook hosted on OneDrive or accessed via Microsoft Teams.
Observed behavior
The COUNTIF formula returns a #VALUE! error when the referenced external workbook is closed, even though VLOOKUP and direct cell links continue to function correctly.
Before you start

Before troubleshooting, ensure you have an active internet connection and sufficient permissions to open the linked external files stored on OneDrive or Microsoft Teams.

Solution 1Recommended

Keep the Linked External Workbook Open

The most straightforward solution is to ensure the source workbook remains open in the background while you are working.

The COUNTIF function has a known limitation in Microsoft Excel: it inherently requires access to the active memory of the referenced workbook. When the external file is closed, Excel cannot process the array criteria, causing it to return a #VALUE! error.

1
Open the source file

Navigate to your OneDrive or Microsoft Teams folder and open the source workbook that your COUNTIF formula is referencing.

2
Recalculate the main workbook

Return to your main working file. The #VALUE! error should automatically resolve into the correct count. If it doesn't, press the F9 key on your keyboard to force a manual recalculation.

Temporary Workaround: This fix requires you to manually open the external workbook every time you need the COUNTIF formulas to update or display correctly.
Free Microsoft Office alternative

Try WPS Office for a Seamless Spreadsheet Experience

If you are tired of dealing with strict Microsoft Excel limitations like the COUNTIF closed-workbook #VALUE! error, consider switching to WPS Office. It provides a lightweight, highly compatible, and completely free alternative for managing your spreadsheets and cross-sheet references without the hassle.

  1. 1. Download and Install: Visit the official WPS website to download and install WPS Office for free on your PC or Mac.
  2. 2. Open Your Spreadsheets: Launch WPS Spreadsheet and open your existing Excel files directly without losing any formatting or data.
  3. 3. Calculate with Ease: Use built-in formulas and manage cross-sheet references smoothly within a unified workspace.
Fully compatible with Microsoft Excel formats, including .xlsx, .xls, and .csv.Free and lightweight alternative to Microsoft Office.Reliable formula calculation capabilities for complex data analysis tasks.Familiar user interface ensuring zero learning curve and seamless migration.
microsoft office alternative - wps office

Frequently Asked Questions

Why does COUNTIF return a #VALUE! error for closed workbooks?

The COUNTIF function, along with COUNTIFS, SUMIF, and SUMIFS, is designed by Microsoft to require the referenced external workbook to remain open in the background. If the source workbook is closed, Excel cannot retrieve the necessary array data to perform the count, resulting in a #VALUE! error.

Does this #VALUE! error happen with local files as well as OneDrive files?

Yes. This is a general architectural limitation of the COUNTIF function when referencing any closed external file. It occurs whether the files are stored locally on your hard drive, synced on OneDrive, or accessed via Microsoft Teams.

Are there other Excel functions that suffer from this closed workbook limitation?

Yes. Besides COUNTIF and COUNTIFS, functions like SUMIF, SUMIFS, COUNTBLANK, and INDIRECT also return a #VALUE! or #REF! error when they reference a closed external workbook. Functions like VLOOKUP, XLOOKUP, and INDEX/MATCH generally continue to work fine.