How to correct a #VALUE! error in the COUNTIF/COUNTIFS function

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")

Do you have a specific function question?

Post a question in the Excel community forum

Help us improve Excel

Do you have suggestions about how we can improve the next version of Excel? If so, please check out the topics at Excel User Voice.

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

Use error checking to detect errors in formulas

All Excel functions (alphabetical)

All Excel functions (by category)

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×