Would this work as a VBA statement? I am trying to use it to say if more than 1 year then group the date by year. The rest I already have, I just need to figure out this last piece of the puzzle.

[vba]IF(SUMPRODUCT(--(YEAR(A2:A" & .Cells(.Rows.Count, 1).End(xlUp).Row & ")=YEAR(A2)))
_ =COUNT(A2:A" & .Cells(.Rows.Count, 1).End(xlUp).Row &") > 1 then[/vba]