Link to home
Start Free TrialLog in
Avatar of kdeutsch
kdeutschFlag for United States of America

asked on

Format and expression string on report

I have a report in which I put a text box that returns the average.  (Done for me)  However I forgot to make sure that it rounds up.  I tried to format it but cant seem to get it correct.  here is the expression
=sum(IIF([expr4]<>0,[expr4],0))/sum(IIF([expr4]<>0,1,0))  Need to round to next # if it has decimals

Thanks
Avatar of rockiroads
rockiroads
Flag of United States of America image

u could try round around everything

=ROUND(sum(IIF([expr4]<>0,[expr4],0))/sum(IIF([expr4]<>0,1,0)),0)

Dont think there is a round up as such in access however you can fiddle it in VBA i.e.

dim dbl x as double
dim intx as integer
dblx = sum(IIF([expr4]<>0,[expr4],0))/sum(IIF([expr4]<>0,1,0))
intx = round(dblx ) + iif(round(dblx )< dblx ,1, 0)

Chris
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial