Calculate number of Sundays in the month
Try this where A1
is the starting day of the month:
=SUMPRODUCT(N(TEXT(ROW(INDIRECT(A1&":"&EOMONTH(A1,0))),"ddd")="Sun"))
You can also use this for any day of the week just change "Sun"
and any date range by replacing A1
with start date and EOMONTH(A1,0)
with end date.
If the date you mention is always the first of the month, then this one will also work:
=INT((WEEKDAY(A1-1)+EOMONTH(A1,0)-A1)/7)
Very similar to a previous answer, but just a little bit cleaner...
=SUMPRODUCT(N(WEEKDAY(ROW(INDIRECT(A1&":"&EOMONTH(A1,0))))=1))