In Google Sheets, I am using the formula shown below to count dates meeting this criterion: >=7/1/2023
=SUM(ARRAYFORMULA(COUNTIF(IFERROR(SPLIT(REGEXREPLACE(IMPORTRANGE("[sheet id]","'Oct 2022'!$O$5:$O$200"),"[\n, ]",CHAR(10)),CHAR(10)),IMPORTRANGE("[sheet id]","'Oct 2022'!$O$5:$O$200")),">="&DATE(2023,7,1))))
The formula works fine, whether the cell contains a single date (e.g. 7/1/2023) or multiple dates (e.g. 6/30/2022, 7/1/2023, 8/22/2023, etc.).
How would I rewrite the formula so that it counts only the MAX date in a multi-date cell, so long as that MAX date meets the specified criteria?
For anyone who might benefit from a spreadsheet formula that counts dates — and/or parts of strings within a particular range that appear like dates — the formula shown in the original post above works as described. I have already used this formula productively on multiple projects.
What I am trying to do is adjust this formula so the parts of a string that look like dates within any particular cell in a given range are counted only if those "dates" are the most recent "date" within a cell containing more than one "date" within the string. In order to be counted, the "date" would also need to meet the criteria specified in the formula (e.g. >=7/1/2023).
In the image included here, all the dates shown in bold color are currently counted. My goal is for the formula to count only the dates shown in bold green.
This formula successfully accomplishes the result I sought in the question I posted above:
=ARRAYFORMULA(SUM(IF(LEN(O5:O200),--(REGEXMATCH(TO_TEXT(O5:O200),"(^|,|\s)\s*(" & TEXTJOIN("|",TRUE,ARRAYFORMULA(TEXT(ROW(INDIRECT("A"&DATE(2023,7,1)&":A"&TODAY())),"m/d/yyyy")))&")\s*($|,|\s)")),0)))