Reputation: 53
Is it possible to compare a month number with a date(MM/DD/YR) in Excel/Google Sheets?
For example, according to the screenshot, I just want to calculate the weekly time only in September and not August. I want it to be general so whatever month I choose, it will only calculate the hours for that month and not other months that is displayed on the table. I think the way to approach the problem is writing an if statement where if the DATE column starts with "9", then it will only calculate that row, and ignore the other rows that is not a 9.
I am just not sure if we can compare multiple cells to see if it matches with a certain month.
Upvotes: 1
Views: 190
Reputation: 75950
You could use SUMIFS
in both Excel or Google Sheets:
=SUMIFS(E2:E8,A2:A8,">="&F10,A2:A8,"<="&EOMONTH(F10,0))
Adjust ranges (and make them absolute if need be)
Upvotes: 1