Forum Discussion

JopOctopus's avatar
JopOctopus
Copper Contributor
Mar 10, 2020

Date Conditions

Dear fellow Excel enthusiasts,

I'm working on a sheet and I'm confident this should be easy to get to work, but I can't seem to get to this right.

The sheet holds the following collumns.

Column A: Names
Column B: Dates

 

I want to count the amount of cells that exactly match a name in row A and are also in between specific dates in row B. So for example, "Piet" in row A and with a date between 01-01-2020 and 31-01-2020 in row B.

 

Also, is there a this can be programmed so Excel automatically recognizes a month and it's amount days? Ideally I'd put something like "January 2020".

Curious to hear your thoughts.

Best,
Jop

2 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    JopOctopus 

    It's better not to hardcode parameters, but keep the in separate cells.

    Assume in H1 you have Piet, and in H2 any date in january, let say 2020-01-15 formatted as mmmm yyyy (i.e. January 2020).

     

    When as variant it could be

    =COUNTIFS(A:A,$H$1,B:B,">" & EOMONTH($H$2,-1), B:B,"<=" & EOMONTH($H$2,0) )
    • JopOctopus's avatar
      JopOctopus
      Copper Contributor

      SergeiBaklanThanks a lot for your detailed explanation, I will have a look and see if it works out like this :-).