Search code examples
excelvbaexcel-formulacountifdate-conversion

Using a CDate in a Countifs function


I was wondering if there was a way to use the CDate function in a countif statement? I'm trying to find dates less than 2 weeks old, am and currently using this statement:

=COUNTIF(CDATE(Table1[Date Closed]),">=" &TODAY() - 14)

I need to turn the Date Closed of the table into actual dates without changing the table (right now they're in the format 13-Mar-2018 but as text format).

Is there a way to do this within the Countif function or am I going to have to do a a VBA code to first change the dates?

Thank you!


Solution

  • =SUMPRODUCT(--(DATEVALUE(Table1[TextDates])>=(TODAY()-14)))
    

    enter image description here

    Although I do wonder why you can't have dates as real Excel dates, rather than text strings