Count items in report without including 0 values

I

ILIRI

I think it is simple but I tried for two hours and I didn't manage this
formula

All I want to do is to count items on report without including records with
0 values. This report contains few Number rows an I can mange other
formulas, for this one I tried: CountIf ([items_billed], ">0"), however it
seem like CountIf can't be used in this case.

Can anyone tell me how should I resolve this formula?
 
M

Marshall Barton

ILIRI said:
I think it is simple but I tried for two hours and I didn't manage this
formula

All I want to do is to count items on report without including records with
0 values. This report contains few Number rows an I can mange other
formulas, for this one I tried: CountIf ([items_billed], ">0"), however it
seem like CountIf can't be used in this case.


AFAIK, CountIf doesn't exist in Access.

There are many other expression that can do that. e.g.

=Count(IIf([items_billed]>0, 1, Null))
=Sum(IIf([items_billed]>0, 1, 0))
=-Sum([items_billed]>0)
 
F

fredg

I think it is simple but I tried for two hours and I didn't manage this
formula

All I want to do is to count items on report without including records with
0 values. This report contains few Number rows an I can mange other
formulas, for this one I tried: CountIf ([items_billed], ">0"), however it
seem like CountIf can't be used in this case.

Can anyone tell me how should I resolve this formula?

In Access you'll need to use Access functions, not Excel functions.
There is no CountIf() function in access.
There is also a difference in fields having a value of 0 ( as a number
value) or "0" (as a text value) or having no value (Null).

Using an unbound control, to count the records where the value in the
[items_billed] field is =0:
=Sum(IIf([items_billed]= 0,1,0))

Now what about fields that are Null as well as those that = 0?
=Sum(IIf(Nz([items_billed],0)=0,1,0))
 
I

ILIRI

thank you it really worked.

in stead of Sum(IIf([items_billed]= 0,1,0)) I used Sum(IIf([items_billed]>
0,1,0)) and I got the results that I was after.

cheers
iliri

fredg said:
I think it is simple but I tried for two hours and I didn't manage this
formula

All I want to do is to count items on report without including records
with
0 values. This report contains few Number rows an I can mange other
formulas, for this one I tried: CountIf ([items_billed], ">0"), however
it
seem like CountIf can't be used in this case.

Can anyone tell me how should I resolve this formula?

In Access you'll need to use Access functions, not Excel functions.
There is no CountIf() function in access.
There is also a difference in fields having a value of 0 ( as a number
value) or "0" (as a text value) or having no value (Null).

Using an unbound control, to count the records where the value in the
[items_billed] field is =0:
=Sum(IIf([items_billed]= 0,1,0))

Now what about fields that are Null as well as those that = 0?
=Sum(IIf(Nz([items_billed],0)=0,1,0))
 

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