Count unique dates stored as text

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,422
Office Version
  1. 2016
Platform
  1. Windows
I have a column of data which comprises of dates stored as text - I need to be able to count the number of unique dates in that range and have tried this;

=SUMPRODUCT(1/COUNTIF(Dates!A2:A50,A2:A50))

but it doesn't work, presumably because they're stored as text.

Any workaround?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
See if this works

=SUMPRODUCT(--(Dates!A2:A50<>""),1/COUNTIF(Dates!A2:A50,Dates!A2:A50&""))

I used Dates!A2:A50&"" to deal with blank cells (if they exist)

M.
 
Last edited:
Upvote 0
Are you doing this formula from a sheet other than the Dates sheet? Your formula may need to be
=SUMPRODUCT(1/COUNTIF(Dates!A2:A50,Dates!A2:A50))
and not
=SUMPRODUCT(1/COUNTIF(Dates!A2:A50,A2:A50))

Irrelevant that it's text.
 
Upvote 0
=SUM(IF(FREQUENCY(MATCH(Dates!A2:A50,Dates!A2:A50,0),MATCH(Dates!A2:A50,Dates!A2:A50,0))>0,1))
it won't work if the range has blank cells in though
 
Last edited:
Upvote 0
I have a column of data which comprises of dates stored as text - I need to be able to count the number of unique dates in that range and have tried this;



but it doesn't work, presumably because they're stored as text.

Any workaround?

One of:

Control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(Dates!A2:A50+0,Dates!A2:A50+0),1))

=SUM(IF(FREQUENCY(IF(1-(Dates!A2:A50=""),MATCH(Dates!A2:A50,Dates!A2:A50,0)),ROW(Dates!A2:A50)-ROW(Dates!A2)+1),1))
 
Upvote 0
Guys, thanks to all who have replied, I'm sure one of these suggestions will work - I'll come back if they don't....
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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