Count Nulls & Not Nulls in Reports

R

RoadKill

I am trying to figure out how to count the Null values and Not Null values in
a field in a report.

We'll just call it Field3 of Query1 of Report1.

Thank you
 
J

John Spencer

In a control in the report footer set the control source to

To Count not nulls all you need is the following. Count counts any
value that is not null and does not count Null values.
=Count(Field3)

To Count Nulls you can test if the field is null and return a value if
so, otherwise return null if there is already a value
=Count(IIF(Field3 is Null,1,Null))

Or count nulls using the following.
=Count(*) - Count(Field3)

Count(*) counts all the records and then you subtract the records that
have a value in field3

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
R

RoadKill

Great, thanks John!

John Spencer said:
In a control in the report footer set the control source to

To Count not nulls all you need is the following. Count counts any
value that is not null and does not count Null values.
=Count(Field3)

To Count Nulls you can test if the field is null and return a value if
so, otherwise return null if there is already a value
=Count(IIF(Field3 is Null,1,Null))

Or count nulls using the following.
=Count(*) - Count(Field3)

Count(*) counts all the records and then you subtract the records that
have a value in field3

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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

Top