Assuming month is text not a formatted date try this formula

=MAX(FREQUENCY(IF(A1:A100="Jan",IF(B1:B100="W", ROW(A1:A100))),IF(A1:A100="Jan",IF(B1:B100<>"W", ROW(A1:A100)))))

confirmed with CTRL+SHIFT+ENTER