View Single Post
  #16  
Old April 27th, 2010, 05:13 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Setting up tables for grades

On Tue, 27 Apr 2010 05:43:01 -0700, Gntlhnds
wrote:

I am actually having another problem. I'm trying to do a report and in the
footer of StudentID I have an unbound text box to calculate the average grade
for each student. Here is the formula I'm using: =Avg(IsNumeric([Grade])).
It doesn't return the correct grade (-0.825), and it gives the same answer
for each student. Any thoughts? I know this is the Forms thread, so I can
move this question to the Reports if need be.


IsNumeric() is a function which returns True (-1) if the value in [Grade] is
numeric, and False (0) if it isn't. Your expression isn't averaging the
grades; it's averaging the -1's and 0's, not what you want at all!

Try

=Avg(IIF(IsNumeric([Grade]), [Grade], Null)

This will check to see if the field is numeric; if it is it will include it in
the average, if it isn't the NULL will be ignored in the average.

Why the need to check? What does the Grade field contain that isn't numeric,
and why are you trying to average non-numeric values?

--

John W. Vinson [MVP]