COUNTIF Using Cell Reference

djmyers

New Member
Joined
Dec 30, 2010
Messages
27
Hello Excel Professionals:

I am trying to count each instance of a particular date within a text string. When I hard-wire the date into the formula, i.e...
=COUNTIF(I:I,"*7/27/2017*")
...I get the count I'm looking for.

My preference would be to use a cell reference for the date, i.e...
=COUNTIF(I:I,"*"&K2&"*")
...however I am unable to make that particular formula work.

Any suggestions?

Thanks!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Make sure your "K2" value is formatted as "Text". Otherwise your search criteria will search for 42943 and not "7/27/2017".
 
Last edited:
Upvote 0
try forcing it to a text string like this

=COUNTIF(I:I,"*"&TEXT(K2,"dd/mm/yyyy")&"*")
 
Upvote 0
Thanks, Beyond_avarice. Formatting both the string column (I:I) and K2 as text seemed to do the trick.
 
Upvote 0
Thank you for your reply, MrTeeny. Your suggestion of forcing K2 to text isn't working for me. Not sure why.
 
Upvote 0

Forum statistics

Threads
1,216,114
Messages
6,128,910
Members
449,478
Latest member
Davenil

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