Evaluating division by zero
Using the iserror function:
=IF(ISERROR(C2/D2),"",C2/D2)
with C2 being your prior years cost, and D2 this years. This will return a
blank cell for new products. You could have it return 100% if you changed ""
to 1.
You could also simply check to see if you had a prior year cost:
=IF(D20,C2/D2,"")
and don't do the division unless you did.
Again - to get a 100% result:
=IF(D20,C2/D2,1)
Hope this helps...
"Shams" wrote:
Folks,
I am simply trying to calculate % Change in Cost b/w two periods. Now, we
may have introduced a new product in the new period which would have zero
cost in the prior period. Therefore, a simple % change calculation for this
product will yield a #DIV/0! error.
I want to be able to copy down a formula that will first evaluate for
ISerror conditions by inputting a zero value and secondly evaluate for all
others by just doing a % change. I am thinking of combining if(iserror(..
with nested if functions...just not sure about the syntax. Any help is
greatly appreciated
|