Countif, including today's date, excluding future dates

valmir

Active Member
Joined
Feb 10, 2021
Messages
267
Office Version
  1. 365
Platform
  1. Windows
Hello everyone
I'm using this formula:
=COUNTIF(D3:AG3;">"&DATE(1900;1;1))
And the reason I'm using this particular formula is that within the "D3:AG3" range, I have cells with formulas whose result is not a date and/or blank cells.
I understand that this formula will count only those cells with results as date.
Now I would like this formula to be modified so as to exclude any future date but to include today's date
Thanks a lot!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I understand that this formula will count only those cells with results as date.
That is not strictly true, but it may be for your particular data. For example, here is that formula working on a smaller range and it has counted more than just the one date cell.
It has counted D3, E3 and I3

24 02 19.xlsm
CDEFGHIJ
3315/06/20232.36a-326666a1.732051
Countif
Cell Formulas
RangeFormula
C3C3=COUNTIF(D3:J3,">"&DATE(1900,1,1))
I3I3=SQRT(3)


So before we move on to your actual question, can you clarify whether this is an issue for you or not?
 
Upvote 0
That is not strictly true, but it may be for your particular data. For example, here is that formula working on a smaller range and it has counted more than just the one date cell.
It has counted D3, E3 and I3

24 02 19.xlsm
CDEFGHIJ
3315/06/20232.36a-326666a1.732051
Countif
Cell Formulas
RangeFormula
C3C3=COUNTIF(D3:J3,">"&DATE(1900,1,1))
I3I3=SQRT(3)


So before we move on to your actual question, can you clarify whether this is an issue for you or not?
Thanks for your prompt reply. In my case, this formula: =COUNTIF(D3:AG3;">"&DATE(1900;1;1)) is ignoring all cells without dates, unlike this formula, for example: =COUNTIF(D3:AG3;"<"&TODAY()) which counts all cells within the range except the ones with future dates! So, any formula is fine as long as it ignores all cells without dates
 
Upvote 0
Could we see a sample of your data with XL2BB so that we can see what formulas you are using in the cells and what sort of values they are producing?
 
Upvote 0
That is not strictly true, but it may be for your particular data. For example, here is that formula working on a smaller range and it has counted more than just the one date cell.
It has counted D3, E3 and I3

24 02 19.xlsm
CDEFGHIJ
3315/06/20232.36a-326666a1.732051
Countif
Cell Formulas
RangeFormula
C3C3=COUNTIF(D3:J3,">"&DATE(1900,1,1))
I3I3=SQRT(3)


So before we move on to your actual question, can you clarify whether this is an issue for you or not?
Just to clarify, there are no blank cells within that range. All cells with formulas, some returning dates, others returning 0
 
Upvote 0
Cell Formulas
RangeFormula
D2D2=INDIRECT($A3&"!$GK$5")
E2E2=INDIRECT($A3&"!$GK$6")
F2F2=INDIRECT($A3&"!$GK$7")
G2G2=INDIRECT($A3&"!$GK$8")
H2H2=INDIRECT($A3&"!$GK$9")
I2I2=INDIRECT($A3&"!$GK$10")
J2J2=INDIRECT($A3&"!$GK$11")
K2K2=INDIRECT($A3&"!$GK$12")
L2L2=INDIRECT($A3&"!$GK$13")
M2M2=INDIRECT($A3&"!$GK$14")
N2N2=INDIRECT($A3&"!$GK$15")
O2O2=INDIRECT($A3&"!$GK$16")
P2P2=INDIRECT($A3&"!$GK$17")
Q2Q2=INDIRECT($A3&"!$GK$18")
R2R2=INDIRECT($A3&"!$GK$19")
S2S2=INDIRECT($A3&"!$GK$20")
T2T2=INDIRECT($A3&"!$GK$21")
U2U2=INDIRECT($A3&"!$GK$22")
V2V2=INDIRECT($A3&"!$GK$23")
W2W2=INDIRECT($A3&"!$GK$24")
X2X2=INDIRECT($A3&"!$GK$25")
Y2Y2=INDIRECT($A3&"!$GK$26")
Z2Z2=INDIRECT($A3&"!$GK$27")
AA2AA2=INDIRECT($A3&"!$GK$28")
AB2AB2=INDIRECT($A3&"!$GK$29")
AC2AC2=INDIRECT($A3&"!$GK$30")
AD2AD2=INDIRECT($A3&"!$GK$31")
AE2AE2=INDIRECT($A3&"!$GK$32")
AF2AF2=INDIRECT($A3&"!$GK$33")
AG2AG2=INDIRECT($A3&"!$GK$34")
AI2AI2=COUNTIF(D3:AG3,">"&DATE(1900,1,1))
D3D3=INDIRECT($A3&"!$GI$5")
E3E3=INDIRECT($A3&"!$GI$6")
F3F3=INDIRECT($A3&"!$GI$7")
G3G3=INDIRECT($A3&"!$GI$8")
H3H3=INDIRECT($A3&"!$GI$9")
I3I3=INDIRECT($A3&"!$GI$10")
J3J3=INDIRECT($A3&"!$GI$11")
K3K3=INDIRECT($A3&"!$GI$12")
L3L3=INDIRECT($A3&"!$GI$13")
M3M3=INDIRECT($A3&"!$GI$14")
N3N3=INDIRECT($A3&"!$GI$15")
O3O3=INDIRECT($A3&"!$GI$16")
P3P3=INDIRECT($A3&"!$GI$17")
Q3Q3=INDIRECT($A3&"!$GI$18")
R3R3=INDIRECT($A3&"!$GI$19")
S3S3=INDIRECT($A3&"!$GI$20")
T3T3=INDIRECT($A3&"!$GI$21")
U3U3=INDIRECT($A3&"!$GI$22")
V3V3=INDIRECT($A3&"!$GI$23")
W3W3=INDIRECT($A3&"!$GI$24")
X3X3=INDIRECT($A3&"!$GI$25")
Y3Y3=INDIRECT($A3&"!$GI$26")
Z3Z3=INDIRECT($A3&"!$GI$27")
AA3AA3=INDIRECT($A3&"!$GI$28")
AB3AB3=INDIRECT($A3&"!$GI$29")
AC3AC3=INDIRECT($A3&"!$GI$30")
AD3AD3=INDIRECT($A3&"!$GI$31")
AE3AE3=INDIRECT($A3&"!$GI$32")
AF3AF3=INDIRECT($A3&"!$GI$33")
AG3AG3=INDIRECT($A3&"!$GI$34")
AH3AH3=COUNTIFS(D4:AG4,">0",D4:AG4,"<=1000")
AI3AI3=AH3-AI2
D4:AG4D4=IFERROR(VALUE(INDEX(INDIRECT($A3&"!$R$2:$FK$51"),50,MATCH(D1,INDIRECT($A3&"!$R$2:$FK$2"),0))) + VALUE(INDEX(INDIRECT($A3&"!$R$2:$FK$51"),50,MATCH(D1,INDIRECT($A3&"!$R$2:$FK$2"),0)+1))/10,"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
AI4,AI7,AI10,AI13,AI16,AI19,AI22,AI25,AI28,AI31,AI34,AI37,AI40,AI43,AI46,BD4:BG4,BD7:BG7,BD10:BG10,BD13:BG13,BD16:BG16,BD19:BG19,BD22:BG22,BD25:BG25,BD28:BG28,BD31:BG31,BD34:BG34,BD37:BG37,BD40:BG40,BD43:BG43,BD46:BG46,AK46:AZ46,AK43:AZ43,AK40:AZ40Expression=IF(AND(B3>0;B4<9);TRUE;FALSE)textNO
AI3Cell Value<0textNO
B2:B46,D2:AI46Cell Value=0textNO
 
Upvote 0
The result in AI2 should be 9 instead of 10
The formula in AI2 is =COUNTIF(D3:AG3,">"&DATE(1900,1,1))
That formula is counting values in row 3 from column D to AG. In that range there are dates in E3, F3, G3, H3, I3, K3, L3, M3, O3, P3
That is 10 dates. So why should it return 9 instead of 10?
 
Upvote 0
The formula in AI2 is =COUNTIF(D3:AG3,">"&DATE(1900,1,1))
That formula is counting values in row 3 from column D to AG. In that range there are dates in E3, F3, G3, H3, I3, K3, L3, M3, O3, P3
That is 10 dates. So why should it return 9 instead of 10?
Because one of them is a future date... :)
 
Upvote 0
Because one of them is a future date... :)
Which one? None of them show a year so impossible to tell from looking at them. Can you format row 3 with a date format that shows day, month and year and post it again with XL2BB?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top