Sum (but not everything)

  • Thread starter Thread starter bw
  • Start date Start date
B

bw

Consider the following Control Source Value:
="Seats Used = " & Sum([PFSeats])

If PFSeats has a specific value (say 9999), then I don't want that
value to be included in the Sum.

How can I accomplish this?

Thanks,
Bernie
 
Consider the following Control Source Value:
="Seats Used = " & Sum([PFSeats])

If PFSeats has a specific value (say 9999), then I don't want that
value to be included in the Sum.

How can I accomplish this?

Thanks,
Bernie

="Seats Used = " & Sum(IIf([PFSeats] <> 9999,Nz([PFSeats]),0))
 
Thanks for the quick reply, Fred.

Your formula is giving me an error as follows:
Extra ) in query expression 'First([ = "Seats Used = " & Sum (IIf([PFSeats] <> 9999,Nz([PFSeats]),0))])'.

Do you have a suggestion for fixing this? And what does the "Nz" in your formula do?

Thanks,
Bernie


Consider the following Control Source Value:
="Seats Used = " & Sum([PFSeats])

If PFSeats has a specific value (say 9999), then I don't want that
value to be included in the Sum.

How can I accomplish this?

Thanks,
Bernie

="Seats Used = " & Sum(IIf([PFSeats] <> 9999,Nz([PFSeats]),0))
 
Never mind Fred, I see the problems is that I have a leading space before the first = sign.

The formula works fine. Thanks, and I appreciate your help.
But again, what does Nz mean?

Bernie

Thanks for the quick reply, Fred.

Your formula is giving me an error as follows:
Extra ) in query expression 'First([ = "Seats Used = " & Sum (IIf([PFSeats] <> 9999,Nz([PFSeats]),0))])'.

Do you have a suggestion for fixing this? And what does the "Nz" in your formula do?

Thanks,
Bernie


Consider the following Control Source Value:
="Seats Used = " & Sum([PFSeats])

If PFSeats has a specific value (say 9999), then I don't want that
value to be included in the Sum.

How can I accomplish this?

Thanks,
Bernie

="Seats Used = " & Sum(IIf([PFSeats] <> 9999,Nz([PFSeats]),0))
 
Never mind Fred, I see the problems is that I have a leading space before the first = sign.

The formula works fine. Thanks, and I appreciate your help.
But again, what does Nz mean?

Bernie

Thanks for the quick reply, Fred.

Your formula is giving me an error as follows:
Extra ) in query expression 'First([ = "Seats Used = " & Sum (IIf([PFSeats] <> 9999,Nz([PFSeats]),0))])'.

Do you have a suggestion for fixing this? And what does the "Nz" in your formula do?

Thanks,
Bernie

On Tue, 15 Jun 2004 18:46:00 GMT, bw wrote:

Consider the following Control Source Value:
="Seats Used = " & Sum([PFSeats])

If PFSeats has a specific value (say 9999), then I don't want that
value to be included in the Sum.

How can I accomplish this?

Thanks,
Bernie

="Seats Used = " & Sum(IIf([PFSeats] <> 9999,Nz([PFSeats]),0))

The Nz() function is only needed if there is a possibility that one of
the records may be null.
In Access, 5+3 +Null = Null.
With the Nz() function, 5+3+Null = 8.

The Arguments for Nz() are
Nz([FieldName],value if null)
Nz([PFSeats],0)
The function defaults to 0, so I didn't use the last argument.
Look it up in VBA help.

If there is no possibility of a null value don't use it, but it won't
hurt if you leave it in:
="Seats Used = " & Sum(IIf([PFSeats] <> 9999,[PFSeats],0))
 
Back
Top