Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Math not taking place

Status
Not open for further replies.

goslincm

MIS
May 23, 2006
292
US
Can anyone see what is wrong with this UPDATE query:

UPDATE Year3TempDistressFactors SET Year3TempDistressFactors.3Score = IIf(IsNull(Yr1GeneralFundRevenue+Yr1GeneralFundExpenditure),Null,IIf(Yr1GeneralFundRevenue-(Yr1GeneralFundExpenditure/Yr1GeneralFundRevenue)<-0.01,0,1));

When this runs against existing data, all the score come back as 1 when some should come through as zero. My math is not taking place.
 
You are subtracting a ratio
Code:
(Yr1GeneralFundExpenditure/Yr1GeneralFundRevenue)
from your revenue
Code:
Yr1GeneralFundRevenue

In order to be less than .01 your expenditures would have to be over 100 times greater than your revenue.

Your math is likely working - your formula is flawed. You likely want
Code:
...IIf([b]1[/b]-(Yr1GeneralFundExpenditure/Yr1GeneralFundRevenue)<-0.01,0,1));

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Or just a parenthesis problem:
IIf((Yr1GeneralFundRevenue-Yr1GeneralFundExpenditure)/Yr1GeneralFundRevenue<-0.01,0,1)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
And, of course, I meant 10000 times greater not 100 times greater. (Mathematically speaking, PHV's and my formula are equal.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top