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?
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
IF function – nested formulas and avoiding pitfalls
See a video on Advanced IF functions