0

Why am I getting a type mismatch error with this code?

"=COUNTIF($A$2:$H$301," * "&L2&" * ")"

I am trying to count the number of instances the name in cell "L2" shows up in the range "A2:H301". As you can see it needs to be a partial match. Image below for a helpful visual.

enter image description here

safo2238
  • 15
  • 6
  • What are you trying to accomplish here? – Hassan A. El-Seoudy Jan 03 '23 at 18:55
  • 2
    remove the spaces between the `"` and the `*` all four of them unless you string starts and ends with a space it will not find a match. Probably not your problem, but something that will give you false negatives. with vba you will need to double the `"`: `"=COUNTIF($A$2:$H$301,""*""&L2&""*"")"` – Scott Craner Jan 03 '23 at 18:57
  • Hassan, I added some context. Scott, thank you, I thought I had already tried that but apparently not. One of those situations where I was going around in circles! Thank you! – safo2238 Jan 03 '23 at 19:04

0 Answers0