ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   counting dates within a rnage (https://www.excelbanter.com/excel-programming/355210-counting-dates-within-rnage.html)

[email protected]

counting dates within a rnage
 
hi i have a list of dates some in the past some in the present. I am
trying to total up the dates that are in the future, but it keeps
returning an inaccurate number. heres the code I am using. Any ideas
or tips would be great

sub
range("a1").select
do until activecell = ""
if activecell date then
total = total+1
end if
activecell.offset(1,0).select
loop
range("b1") = total


Bob Phillips[_6_]

counting dates within a rnage
 
Guessing a bit, but maybe

sub
range("a1").select
do until activecell = ""
If IsDate(Activecell.Value) Then
if activecell date then
total = total+1
end if
End If
activecell.offset(1,0).select
loop
range("b1") = total


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
oups.com...
hi i have a list of dates some in the past some in the present. I am
trying to total up the dates that are in the future, but it keeps
returning an inaccurate number. heres the code I am using. Any ideas
or tips would be great

sub
range("a1").select
do until activecell = ""
if activecell date then
total = total+1
end if
activecell.offset(1,0).select
loop
range("b1") = total




Carim[_3_]

counting dates within a rnage
 
Hi John,

As a first step, following formula will do the job :
=COUNTIF(A1:A10,"06.03.2006")

if all your dates are located in A1:A10 range,
and if today is your reference point ...

HTH
Cheers
Carim



All times are GMT +1. The time now is 02:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com