Home » excel » excel – Comparing Month with date(MM/DD/YR)

excel – Comparing Month with date(MM/DD/YR)

Posted by: admin May 14, 2020 Leave a comment

Questions:

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.

enter image description here

How to&Answers:

all you need is:

=SUM(FILTER(B1:B7, MONTH(A1:A7)=8))

0

Answer:

You could use SUMIFS in both Excel or Google Sheets:

=SUMIFS(E2:E8,A2:A8,">="&F10,A2:A8,"<="&EOMONTH(F10,0))

enter image description here

Adjust ranges (and make them absolute if need be)