D daryll Registered User. Local time Today, 14:07 Joined Jan 2, 2018 Messages 49 Jan 14, 2018 #1 Hi! Why this code still throws an overflow error Code: IIf( (cbStatNotStarted=0 Or cbStatTotal=0), 0, (cbStatNotStarted / cbStatTotal) * 100 )
Hi! Why this code still throws an overflow error Code: IIf( (cbStatNotStarted=0 Or cbStatTotal=0), 0, (cbStatNotStarted / cbStatTotal) * 100 )
D daryll Registered User. Local time Today, 14:07 Joined Jan 2, 2018 Messages 49 Jan 14, 2018 #2 Thanks! I got it!
NauticalGent Ignore List Poster Boy Local time Today, 17:07 Joined Apr 27, 2015 Messages 6,754 Jan 14, 2018 #3 I suspect it has something to do with the numbers themselves. Can you provide an example of what kind of values are in the equation. Also, you should always check for null and Zero values, especially if you are doing division.
I suspect it has something to do with the numbers themselves. Can you provide an example of what kind of values are in the equation. Also, you should always check for null and Zero values, especially if you are doing division.
NauticalGent Ignore List Poster Boy Local time Today, 17:07 Joined Apr 27, 2015 Messages 6,754 Jan 14, 2018 #4 Apologies, forget about what I said regarding checking for Zero, I can see now that you have. I tend to go off half-cocked...
Apologies, forget about what I said regarding checking for Zero, I can see now that you have. I tend to go off half-cocked...
D daryll Registered User. Local time Today, 14:07 Joined Jan 2, 2018 Messages 49 Jan 14, 2018 #5 NauticalGent said: Apologies, forget about what I said regarding checking for Zero, I can see now that you have. I tend to go off half-cocked... Click to expand... Thanks for dropping in.
NauticalGent said: Apologies, forget about what I said regarding checking for Zero, I can see now that you have. I tend to go off half-cocked... Click to expand... Thanks for dropping in.
M Mark_ Longboard on the internet Local time Today, 14:07 Joined Sep 12, 2017 Messages 2,399 Jan 14, 2018 #6 Let me guess, your solution was Code: IIf( (nz(cbStatNotStarted,0)=0 Or nz(cbStatTotal,0)=0), 0, (cbStatNotStarted / cbStatTotal) * 100 ) so you could check for either zero OR null all in one fell swoop?
Let me guess, your solution was Code: IIf( (nz(cbStatNotStarted,0)=0 Or nz(cbStatTotal,0)=0), 0, (cbStatNotStarted / cbStatTotal) * 100 ) so you could check for either zero OR null all in one fell swoop?
D daryll Registered User. Local time Today, 14:07 Joined Jan 2, 2018 Messages 49 Jan 18, 2018 #7 Mark_ said: Let me guess, your solution was Code: IIf( (nz(cbStatNotStarted,0)=0 Or nz(cbStatTotal,0)=0), 0, (cbStatNotStarted / cbStatTotal) * 100 ) so you could check for either zero OR null all in one fell swoop? Click to expand... This is the version I have Code: (IIf(cbStatNotStarted = 0, 0, cbStatNotStarted) / IIf(cbStatTotal = 0, 1, cbStatTotal)) * 100
Mark_ said: Let me guess, your solution was Code: IIf( (nz(cbStatNotStarted,0)=0 Or nz(cbStatTotal,0)=0), 0, (cbStatNotStarted / cbStatTotal) * 100 ) so you could check for either zero OR null all in one fell swoop? Click to expand... This is the version I have Code: (IIf(cbStatNotStarted = 0, 0, cbStatNotStarted) / IIf(cbStatTotal = 0, 1, cbStatTotal)) * 100
P plog Banishment Pending Local time Today, 16:07 Joined May 11, 2011 Messages 11,980 Jan 18, 2018 #8 No need to test cbSTartNotStarted at all: For all x<>0, 0/x = 0