COUNTIF not working with formatted cells

Kingchaos64

New Member
Joined
Jan 15, 2021
Messages
46
Office Version
  1. 365
Platform
  1. Windows
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.

kanadaaa

Active Member
Joined
Dec 29, 2019
Messages
348
Office Version
  1. 365
Platform
  1. Windows
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
Joined
Jan 15, 2021
Messages
46
Office Version
  1. 365
Platform
  1. Windows
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
Joined
May 28, 2005
Messages
48,560
Office Version
  1. 365
Platform
  1. Windows
See if this counts what you want?
Excel Formula:
=COUNT(FILTER(E5:OV5,LEN(E5:OV5)=6,""))
 
Solution

Watch MrExcel Video

Forum statistics

Threads
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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top