Home » excel » In Excel, COUNTIF() not working with constant defined string[]

In Excel, COUNTIF() not working with constant defined string[]

Posted by: admin April 23, 2020 Leave a comment

Questions:

This question is an expansion on https://superuser.com/questions/601419/in-excel-how-do-i-check-if-a-cell-is-in-a-list-of-values-a-range-of-cells .

I’m trying to do =COUNTIF(name,G6) and when name refers to some cells, it works fine, but when it refers to my constant string array it gives #VALUE!

My constant string array (using the name manager) is ={"192.168.3.2","192.168.3.10"}… etc, and that may be my problem. But ironically, if I set cell contents to that array and reference the cells, it works fine.

Thanks

How to&Answers:

You can use SUMPRODUCT like this:

=SUMPRODUCT(1*(name=G6))