# Countif for a constant value

#### Spockster

##### Board Regular
I have a sheet that I am doing a match and a countif the value appears. However the value I am looking for is in the middle of other text. It looks something like this. "Outbond Service - 45879 - Services" and I want to be able to count the constant value of "45879" How can this be done. My formula is
=IF(ISNA(COUNTIF(INDEX('Sheet 1'!\$1:\$65536,0,MATCH("Position Owner",'Sheet 1'!\$1:\$1,0)),"*""B5""*")),"0",COUNTIF(INDEX('Sheet 1'!\$1:\$65536,0,MATCH("Position Owner",'Sheet 1'!\$1:\$1,0)),"*""B5""*"))

The formula works great but now with the text around my value it doesn't count. Any help would be great.

Thank you

### Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try changing the criterion for COUNTIF to...

"*"&B5&"*"

Hope this helps!

Also, I think the following would suffice...

=IF(ISNUMBER(MATCH("Position Owner",'Sheet 1'!\$1:\$1,0)),COUNTIF(INDEX('Sheet 1'!\$1:\$65536,0,MATCH("Position Owner",'Sheet 1'!\$1:\$1,0)),"*"&B5&"*"))

Hope this helps!

It worked!! thank you

Thank you for your quick help

Replies
5
Views
245
Replies
5
Views
221
Replies
1
Views
201
Replies
8
Views
132
Replies
1
Views
126

1,203,605
Messages
6,056,251
Members
444,853
Latest member
sam69

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back