Search code examples
google-sheetsgoogle-sheets-querygoogle-sheets-formula

What is the Countif code for time range and date today? Thanks


How can I simplify my code below without the hassle of updating the date every single day?

=COUNTIFS(Sheet2!A2:A5797,">=1/3/2019 7:00",Sheet2!A2:A5797,"<=1/3/2019 8:00",Sheet2!D2:D5797,"Resolved")

I should have a result when 3 conditions are met, like the time, date, and status(Resolved).


Solution

  • First I would suggest feeding the date-times as parameters, say:

    =COUNTIFS(Sheet2!A2:A,">="&I1,Sheet2!A2:A,"<="&J1,Sheet2!D2:D,"Resolved")
    

    so the results are determined by what you put in cells, rather than how you adapt a formula.

    Then you might split dates and times as it seems it may only be the date you wish to change, thus say:

    I1: =E1+F1 and J1: =G1+H1

    where E1 and G1 are dates and F1 and H1 times.

    Then if the times are always during the same day as one another: G1: =E1.

    And if some automation is required, possibly:

    E1:- =today(), or perhaps =today()+n, where n is an integer offset of choice.