# COUNTIF not working with formatted cells

#### Kingchaos64

##### New Member
I have a formula of =COUNTIF(E5:OV5,"*-*")

I would like this formula to count all the cells in row 5 that have a dash in them. The cells that have a dashes look like this 00-00-00. To make data entry easier I put a custom formula in the columns and used 00-00-00 as the sample.
Which works great, it makes it super fast to enter the set of numbers without having to put in the dash.

The problem is the COUNTIF formula doesn't recognize the numbers as having dashes so it doesn't count them

Is there a work around to this?

### Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

##### Active Member
If you have the custom cell format "##-##-##", any 6-digit number will appear with hyphens.
Then, why do you have to find hyphens, if all the numeric data in the row have hyphens?
Is there any reason why you can't just use =COUNTIF(E5:OV5,"<>")?

#### Kingchaos64

##### New Member
If you have the custom cell format "##-##-##", any 6-digit number will appear with hyphens.
Then, why do you have to find hyphens, if all the numeric data in the row have hyphens?
Is there any reason why you can't just use =COUNTIF(E5:OV5,"<>")?
There is other numerical data in the row which I don't want counted but the data I want counted will always be a 6 digit number and none of the other data would be that many numbers. Could I do a countif equals 6 somehow?

#### Peter_SSs

##### MrExcel MVP, Moderator
See if this counts what you want?
Excel Formula:
``=COUNT(FILTER(E5:OV5,LEN(E5:OV5)=6,""))``

#### Kingchaos64

##### New Member
See if this counts what you want?
Excel Formula:
``=COUNT(FILTER(E5:OV5,LEN(E5:OV5)=6,""))``
Ok I'll try that tomorrow morning thanks

Replies
2
Views
50
Replies
4
Views
143
Replies
4
Views
101
Replies
2
Views
86
Replies
3
Views
172

1,130,123
Messages
5,640,245
Members
417,131
Latest member
Seanr19871

### 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