PC Review


Reply
Thread Tools Rate Thread

Average values excluding nulls and zeros

 
 
=?Utf-8?B?bml1Z2luaWtpd2k=?=
Guest
Posts: n/a
 
      1st Sep 2006
Hi,
I have a report that is based on a query. On the report footer I have a
txtAvg (=Avg([HDays]) which is a calculated field in the query that is on
the report. This calculated field is based on two date fields (ie number of
days between two dates). If one date isn't entered there is no value.
What I want to do is have the average of HDays calculated excluding all
values that are equal to zero or null.
I know this will be easy but I just can't figure it out.

Thanks for any help I may get.
--
niuginikiwi
Nelson, New Zealand
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      1st Sep 2006
Avg() ignores nulls, so perhaps you could convert your zeros to nulls before
averaging:
=Avg(IIf([HDays]=0, Null, [HDays]))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"niuginikiwi" <(E-Mail Removed)> wrote in message
news:0D343BAD-FDD1-4017-9AA9-(E-Mail Removed)...
> Hi,
> I have a report that is based on a query. On the report footer I have a
> txtAvg (=Avg([HDays]) which is a calculated field in the query that is on
> the report. This calculated field is based on two date fields (ie number
> of
> days between two dates). If one date isn't entered there is no value.
> What I want to do is have the average of HDays calculated excluding all
> values that are equal to zero or null.
> I know this will be easy but I just can't figure it out.
>
> Thanks for any help I may get.
> --
> niuginikiwi
> Nelson, New Zealand



 
Reply With Quote
 
=?Utf-8?B?bml1Z2luaWtpd2k=?=
Guest
Posts: n/a
 
      3rd Sep 2006
Thanks Allen,
That not only worked but clarified my understanding a little about nulls and
zeros.
Once again, thanks so much.
--
niuginikiwi
Nelson, New Zealand


 
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
How do I average time (hh:mm:ss) excluding zeros? TRLambert Microsoft Excel Misc 2 8th Dec 2009 04:53 PM
average percentage excluding zeros from several worksheets Brandy Microsoft Excel Misc 0 17th Jun 2008 08:34 PM
Average, Excluding Zeros, Non-Consecutive Range =?Utf-8?B?Q29hbCBNaW5lcg==?= Microsoft Excel Misc 9 4th Aug 2005 10:21 PM
EXcluding Zeros from the average in a row =?Utf-8?B?R2Vv?= Microsoft Excel Misc 4 31st Dec 2004 04:07 PM
Excluding Zeros in an Average Tammy Microsoft Access Reports 1 17th Sep 2003 05:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:24 AM.