Worked fine until added IIF (1 Viewer)

Amileaux

Registered User.
Local time
Today, 07:19
Joined
May 6, 2003
Messages
98
The following is on a query I am using to calculated percentages:

Switch % Capacity Utilized: 1-([Switch Ports Available]/[Switch Total Ports Turned Up])

Because I have some instances where the divisor is a zero, I was getting "Error" - so I revised the above to:

Switch % Capacity Utilized: IIf([switch total ports turned up]=0,"0",1-([Switch Ports Available]/[Switch Total Ports Turned Up]))

Now none of the fields format correctly AND I get alot of percentages with "E", where previously there was no problem:

8.33333333333334E-02

Any thoughts as to what is causing this? Marie
 

dcx693

Registered User.
Local time
Today, 09:19
Joined
Apr 30, 2003
Messages
3,265
Why are you having the IIF function return a "0" as a string? Why not use the number 0? I've noticed some weirdness when mixing string and numerical results from IIF functions. I never took the time to investigate what the cause was.
 

Amileaux

Registered User.
Local time
Today, 07:19
Joined
May 6, 2003
Messages
98
dcx693 said:
Why are you having the IIF function return a "0" as a string? Why not use the number 0? I've noticed some weirdness when mixing string and numerical results from IIF functions. I never took the time to investigate what the cause was.


You are correct - that was the problem - as soon as I removed the quotes from around the zero it worked! thanks. Marie
 

Users who are viewing this thread

Top Bottom