IIF Error

Purdue15

Registered User.
Local time
Yesterday, 16:41
Joined
Jun 12, 2013
Messages
29
Im calculating error percentages and if the second number subtracted in the numerator is blank its should actually be 100 %, instead it displays #Error. Is there a way that I can type an iif statement in criteria so that if there is an error I can make it equal to something else like '0' or 'correct'?
 
Here is the attachment
 

Attachments

  • Error Statement.png
    Error Statement.png
    84.9 KB · Views: 132
Im calculating error percentages and if the second number subtracted in the numerator is blank its should actually be 100 %, instead it displays #Error. Is there a way that I can type an iif statement in criteria so that if there is an error I can make it equal to something else like '0' or 'correct'?

I can see two possibilities for your error:
  1. CWeight = 0
    • In this case, an IIf() Statement can be used to replace the error condition.
  2. CWeight or NWeight are Null
    • In this case, Nz() can be used to replace the Nulls with an appropriate default value.
Additional details about your situation might be required before any better information can be provided.

-- Rookie
 
Ok well the C columns are always going to be completely filled out no matter what. The N columns are the only ones that will be empty and most of them will be empty if there wasnt a change. So a lot of times there will be very few changes. I tried this and it didnt work
Nz([NWeight],'OK')
 

Attachments

  • Comparison.png
    Comparison.png
    27.9 KB · Views: 107
  • Percentages.png
    Percentages.png
    32.3 KB · Views: 117
Last edited:
Ok well the C columns are always going to be completely filled out no matter what. The N columns are the only ones that will be empty and most of them will be empty if there wasnt a change. So a lot of times there will be very few changes. I tried this and it didnt work
Nz([NWeight],'OK')

Thank you for providing much better information. The Nz() solution will be a good place to start for you, but your implementation does not appear to be consistant with your proposed usage.

The previous exhibit { Weight: ([CWeight]-[NWeight])/[CWeight]*100 }, shows NWeight being used as a part of a Math Equation. If that is true, then NWeight needs to be a number. Your current exhibit { Nz([NWeight],'OK') } makes NWeight a String. Changing the 'OK' to an appropriate number is what you want to do, although you may need to play with it until you find the correct value.

-- Rookie
 
Last edited:

Users who are viewing this thread

Back
Top Bottom