Stuck on countif

caliroom

New Member
Joined
Oct 16, 2018
Messages
2
I can't seem to get a count if formula to work. I have a range of cells see below.

I would like to count the number of times a value is in a cell such as "01" or "24"

The formula returns zero count because I believe it is looking for only the "01" or "24" and if the cell contains other numbers or characters it will pass the cell in the count if formula. am i using the wrong formula or not structuring the count if correctly? I also notice the formula drops the zero on 01 and not sure if that is an issue too.

Thank you for any help...
Jeff


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]a[/TD]
[TD]b[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]01-03-15-20-22-24-25-37-39-42-43-45-50-58-63-70-74-75-78-80[/TD]
[TD]**[/TD]
[TD]**[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]05-06-15-19-24-25-26-27-30-31-32-42-52-59-60-67-68-75-76-79[/TD]
[TD]**[/TD]
[TD]**[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]04-08-09-14-22-25-34-39-40-43-55-57-58-59-61-64-66-70-71-76[/TD]
[TD]**[/TD]
[TD]**[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Welcome to the forum.

Try:


Book1
ABCD
101-03-15-20-22-24-25-37-39-42-43-45-50-58-63-70-74-75-78-80CodeCount
205-06-15-19-24-25-26-27-30-31-32-42-52-59-60-67-68-75-76-79011
304-08-09-14-22-25-34-39-40-43-55-57-58-59-61-64-66-70-71-76152
4253
5752
6770
Sheet1
Cell Formulas
RangeFormula
D2=COUNTIF(A$1:A$5,"*"&C2&"*")


Firstly, you need to select column C (in this example) and change the format to Text. That will prevent Excel from changing 01 to 1. Next, to check for a specific number within some text, you need to add wildcards before and after the number. The "*" means match anything.

If you don't want to format column C as text, you can use this formula:

=COUNTIF(A$1:A$5,"*"&TEXT(C2,"00")&"*")
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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
Back
Top