formula for totaling

  • Thread starter Thread starter He cries for help
  • Start date Start date
H

He cries for help

I have created thiis formula " =[PRICE1]+[PRICE2]+[PRICE3]+[PRICE4]+[PRICE5]
" to total the value of the five fields named above, I have to enter data in
all five fieldsfor it to work. How can I get it to total when i only have to
use a partial number of the fields?
 
Anything plus Null equals Null. Nz(FieldName, 0) converts a Null field to
zero so try

=Nz([PRICE1],0)+Nz([PRICE2],0)+Nz([PRICE3],0)+Nz([PRICE4],0)+Nz([PRICE5],0)
 
Use the NZ function...
=NZ([PRICE1])+NZ([PRICE2])+NZ([PRICE3])+NZ([PRICE4])+NZ([PRICE5])
If any element of the calculation is Null... NZ will (by default) substitute
a 0 in it's place.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Back
Top