With
A1:A20 containing various dates (and possibly some blanks)
This ARRAY FORMULA (committed with CTRL+SHIFT+ENTER,
instead of just ENTER) returns the count of unique months:
B1: =COUNT(1/FREQUENCY(IF(A1:A20>0,--TEXT(A1:A20,"yyyymm")),--TEXT(A1:A20,"yyyymm")))
EDITED to include this regular (non-array)
AND RE-EDITED to prevent it from returning: 1 when no values are present:
B1: =COUNT(INDEX(1/FREQUENCY(--TEXT(A1:A20,"yyyymm"),--TEXT(A1:A20,"yyyymm"))/(A1:A20<>""),0))
Is that something you can work with?
Bookmarks