PC Review


Reply
Thread Tools Rate Thread

DateDiff and Count/Sum

 
 
caro
Guest
Posts: n/a
 
      14th Apr 2010
I am trying to count records where the scheduled date is greater than the
current date. All Dates (past visits and scheduled visits) are listed in the
Date of Awareness field. The expressions I have tried include:
=IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
=Abs(Sum([Date of Awareness]> Date()))
Please let me know if I am even on the right track.
-Caro
 
Reply With Quote
 
 
 
 
Jeff Boyce
Guest
Posts: n/a
 
      14th Apr 2010
Where are you doing this? In a query?

Could you use a query, include the [Date of Awareness] field, and in the
criteria, use something like (untested):

>Date()


Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"caro" <(E-Mail Removed)> wrote in message
news:331E73B1-84FD-40F1-9DA3-(E-Mail Removed)...
>I am trying to count records where the scheduled date is greater than the
> current date. All Dates (past visits and scheduled visits) are listed in
> the
> Date of Awareness field. The expressions I have tried include:
> =IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
> =Abs(Sum([Date of Awareness]> Date()))
> Please let me know if I am even on the right track.
> -Caro



 
Reply With Quote
 
Duane Hookom
Guest
Posts: n/a
 
      14th Apr 2010
What was the result for
=Abs(Sum([Date of Awareness]> Date()))
Where did you enter this? What section of the report?

--
Duane Hookom
Microsoft Access MVP


"caro" wrote:

> I am trying to count records where the scheduled date is greater than the
> current date. All Dates (past visits and scheduled visits) are listed in the
> Date of Awareness field. The expressions I have tried include:
> =IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
> =Abs(Sum([Date of Awareness]> Date()))
> Please let me know if I am even on the right track.
> -Caro

 
Reply With Quote
 
KARL DEWEY
Guest
Posts: n/a
 
      15th Apr 2010
Your =IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
has closing parenthesis misplaced like this --
=IIF(DateDiff("d", [Date of Awareness], Date())>1,1,0)

Your =Abs(Sum([Date of Awareness]> Date()))
is missing an IIF like this --
=Abs(Sum(IIF([Date of Awareness]> Date(), 1, 0)))
and it does not need the Abs function.

--
Build a little, test a little.


"caro" wrote:

> I am trying to count records where the scheduled date is greater than the
> current date. All Dates (past visits and scheduled visits) are listed in the
> Date of Awareness field. The expressions I have tried include:
> =IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
> =Abs(Sum([Date of Awareness]> Date()))
> Please let me know if I am even on the right track.
> -Caro

 
Reply With Quote
 
Duane Hookom
Guest
Posts: n/a
 
      15th Apr 2010
Karl,
Aren't these the same:
=Abs(Sum([Date of Awareness]> Date()))
=Abs(Sum(IIF([Date of Awareness]> Date(), 1, 0)))

This expression will return -1 for true or 0 for false
[Date of Awareness]> Date()

If you Sum() this expression, it will return a negative count of the number
of records that return true.

Changing the negative to positive with Abs() should provide the same value
as your suggestion. Or, did I miss something?

--
Duane Hookom
Microsoft Access MVP


"KARL DEWEY" wrote:

> Your =IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
> has closing parenthesis misplaced like this --
> =IIF(DateDiff("d", [Date of Awareness], Date())>1,1,0)
>
> Your =Abs(Sum([Date of Awareness]> Date()))
> is missing an IIF like this --
> =Abs(Sum(IIF([Date of Awareness]> Date(), 1, 0)))
> and it does not need the Abs function.
>
> --
> Build a little, test a little.
>
>
> "caro" wrote:
>
> > I am trying to count records where the scheduled date is greater than the
> > current date. All Dates (past visits and scheduled visits) are listed in the
> > Date of Awareness field. The expressions I have tried include:
> > =IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
> > =Abs(Sum([Date of Awareness]> Date()))
> > Please let me know if I am even on the right track.
> > -Caro

 
Reply With Quote
 
KARL DEWEY
Guest
Posts: n/a
 
      15th Apr 2010
You did not miss anything, I just do not know a lot of things.
--
Build a little, test a little.


"Duane Hookom" wrote:

> Karl,
> Aren't these the same:
> =Abs(Sum([Date of Awareness]> Date()))
> =Abs(Sum(IIF([Date of Awareness]> Date(), 1, 0)))
>
> This expression will return -1 for true or 0 for false
> [Date of Awareness]> Date()
>
> If you Sum() this expression, it will return a negative count of the number
> of records that return true.
>
> Changing the negative to positive with Abs() should provide the same value
> as your suggestion. Or, did I miss something?
>
> --
> Duane Hookom
> Microsoft Access MVP
>
>
> "KARL DEWEY" wrote:
>
> > Your =IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
> > has closing parenthesis misplaced like this --
> > =IIF(DateDiff("d", [Date of Awareness], Date())>1,1,0)
> >
> > Your =Abs(Sum([Date of Awareness]> Date()))
> > is missing an IIF like this --
> > =Abs(Sum(IIF([Date of Awareness]> Date(), 1, 0)))
> > and it does not need the Abs function.
> >
> > --
> > Build a little, test a little.
> >
> >
> > "caro" wrote:
> >
> > > I am trying to count records where the scheduled date is greater than the
> > > current date. All Dates (past visits and scheduled visits) are listed in the
> > > Date of Awareness field. The expressions I have tried include:
> > > =IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
> > > =Abs(Sum([Date of Awareness]> Date()))
> > > Please let me know if I am even on the right track.
> > > -Caro

 
Reply With Quote
 
Duane Hookom
Guest
Posts: n/a
 
      15th Apr 2010
Karl,
I have learned a lot from your past posts so I was a bit concerned I had
messed up the syntax/expression.

--
Duane Hookom
Microsoft Access MVP


"KARL DEWEY" wrote:

> You did not miss anything, I just do not know a lot of things.
> --
> Build a little, test a little.
>
>
> "Duane Hookom" wrote:
>
> > Karl,
> > Aren't these the same:
> > =Abs(Sum([Date of Awareness]> Date()))
> > =Abs(Sum(IIF([Date of Awareness]> Date(), 1, 0)))
> >
> > This expression will return -1 for true or 0 for false
> > [Date of Awareness]> Date()
> >
> > If you Sum() this expression, it will return a negative count of the number
> > of records that return true.
> >
> > Changing the negative to positive with Abs() should provide the same value
> > as your suggestion. Or, did I miss something?
> >
> > --
> > Duane Hookom
> > Microsoft Access MVP
> >
> >
> > "KARL DEWEY" wrote:
> >
> > > Your =IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
> > > has closing parenthesis misplaced like this --
> > > =IIF(DateDiff("d", [Date of Awareness], Date())>1,1,0)
> > >
> > > Your =Abs(Sum([Date of Awareness]> Date()))
> > > is missing an IIF like this --
> > > =Abs(Sum(IIF([Date of Awareness]> Date(), 1, 0)))
> > > and it does not need the Abs function.
> > >
> > > --
> > > Build a little, test a little.
> > >
> > >
> > > "caro" wrote:
> > >
> > > > I am trying to count records where the scheduled date is greater than the
> > > > current date. All Dates (past visits and scheduled visits) are listed in the
> > > > Date of Awareness field. The expressions I have tried include:
> > > > =IIF(DateDiff("d", [Date of Awareness], Date()>1,1,0))
> > > > =Abs(Sum([Date of Awareness]> Date()))
> > > > Please let me know if I am even on the right track.
> > > > -Caro

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
count duplicats, display incremental count, restart count at changein value JenIT Microsoft Excel Programming 2 24th Aug 2010 09:10 PM
Count Only Weekday in the DateDiff Function phm Microsoft Access Reports 1 7th Jan 2010 03:50 PM
how to get count(col1), count(col2), count(sol3) with only one query Mario Krsnic Microsoft Access Queries 2 27th Oct 2006 06:52 PM
datediff, count excluding holidays Kate Microsoft Access 8 13th Sep 2005 09:37 PM
Help with DateDiff and Count Expression Dave Microsoft Access Queries 2 10th Mar 2004 02:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:50 AM.