Problem with Avg calculation in subform


G

Guest

Hello,

I am having a problem with an average calculation on my form. I have a
continuous form with a field called "Score" and that field can either have a
numerical value in it or an "NA" in it. I have the following code in "score."

=IIf([Score]=0,"NA",[Score])

The problem is, I want to take an average of all the NUMERICAL scores in
that in subform, and not include the NAs (0s). However....I am getting an
average INCLUDING those zero amounts and I want to exclude those.

here is the code i'm currently usinig in that average score field:

=Avg(IIf([Score]<>"NA",([Score])))

However, this is not giving me the desired result -- it's including those
zeros in there.

Any ideas?

Thanks,
MN
 
Ad

Advertisements

J

John W. Vinson

Hello,

I am having a problem with an average calculation on my form. I have a
continuous form with a field called "Score" and that field can either have a
numerical value in it or an "NA" in it. I have the following code in "score."

=IIf([Score]=0,"NA",[Score])

The problem is, I want to take an average of all the NUMERICAL scores in
that in subform, and not include the NAs (0s). However....I am getting an
average INCLUDING those zero amounts and I want to exclude those.

here is the code i'm currently usinig in that average score field:

=Avg(IIf([Score]<>"NA",([Score])))

However, this is not giving me the desired result -- it's including those
zeros in there.

Try
=IIF([Score] = 0, Null, [Score])

Avg() will ignore the nulls; you can use a format of

"#";"-#";"0";"NA"

to display the Null values as NA.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top