Trying to use the NZ Function with #num! as a result

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HBCPH
    New Member
    • Dec 2011
    • 5

    Trying to use the NZ Function with #num! as a result

    I have a form with a calculated field (Business #1 DCR)see attachment. The field has a data Control Source of: =([N/IBus1]+[DepAmorBus1]+[IntExpBus1])/([ExistingDebtPym tsBus1]+[ProposedDebtSer viceBus1])with a Default Value of 0. Which works fine if there are numbers in the related fields, but produces #Num! if the related fields all have the default 0. I would like result to be blank or have a 0 as a result if the related fields contain the default 0. I have tried numerous Nz calculations but have not been successful. Anyone have any ideas how to resolve this? Any help would be greatly appreciated. Thanks
    [IMGNOTHUMB]http://bytes.com/attachments/attachment/6008d1327952568/formpic.jpg[/IMGNOTHUMB]
    Attached Files
    Last edited by NeoPa; Jan 30 '12, 09:50 PM. Reason: Made pic viewable
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Nz is to be used with nulls. From the sounds of it, you don't have nulls. You're trying to divide by 0 and that's causing an error. Use the iif() function to display a different result if the denominators are 0.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32661

      #3
      You describe a situation where you have Divide by Zero errors (#Num!). This is entirely unrelated to nulls in any form.

      To avoid these errors you need to check for a result of zero (0) in your divisor, for such a formula is incalculable. Use IIf() to do this, as in :
      Code:
      =IIf([ExistingDebtPymtsBus1]+[ProposedDebtServiceBus1]=0,0,([N/IBus1]+[DepAmorBus1]+[IntExpBus1])/([ExistingDebtPymtsBus1]+[ProposedDebtServiceBus1]))

      Comment

      Working...