I'm trying to count how many cells with dates in them that are within in a date range.
I have dates in column G in a tab and then I have 2 cells in another tab that makes the range.
The daterange contains these formulas. =Now()
and the other is =Now 7
.
I have been googling around for a answer but the ones that I found seems to have a "fixed date" for the date range and that is not what I'm looking for here.
Looking forward for some help.
Cheers!
CodePudding user response:
This can be done with a simple COUNTIFS
formula.
If the criteria for the date range are in B1,=NOW()
, and B2, =NOW() 7
, on Sheet2 you could use this formula on the sheet with the dates in column G.
=COUNTIFS(G2:G21, ">="&Sheet2!B1, G2:G21,"<="&Sheet2!B2)
CodePudding user response:
try:
=COUNTIFS(G:G; ">="&NOW(); G:G; "<"&NOW() 8)