This topic lists the more common causes of the #VALUE! error in the COUNTIF and COUNTIFS functions.

Problem: The formula refers to cells in a closed workbook

COUNTIF/COUNTIFS functions that refer to a cell or a range in a closed workbook will result in a #VALUE! error.

Note: This is a known issue with several other Excel functions such as SUMIF, SUMIFS, COUNTBLANK, to name a few. See SUMIF, COUNTIF and COUNTBLANK functions return #VALUE! error for more information.

Solution: Open the linked workbook indicated in the formula, and press F9 to refresh the formula.

You can also work around this issue by using SUM and IF functions together in an array formula. See SUMIF, COUNTIF and COUNTBLANK functions return #VALUE! error for more information.

Problem: The string is more than 255 characters

Solution: Shorten the string if possible. If you can’t shorten it, use the CONCATENATE function or the ampersand (&) operator to break down the value into multiple strings. For example,

  • =COUNTIF(B2:B12,"long string"&"another long string")

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

See Also

Correct a #VALUE! error

COUNTIF function

COUNTIFS function

IF function – nested formulas and avoiding pitfalls

See a video on Advanced IF functions

Overview of formulas in Excel

How to avoid broken formulas

Detect errors in formulas

All Excel functions (alphabetical)

All Excel functions (by category)

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Office Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×