Percentage with a zero involved
"tankerman" wrote:
A1 is this month total
B1 is last months total
C1 is the difference, =A1-B1
[...] D1 is the difference in percentage,
I use =(A1-B1)/B1
Of course, you can simplify D1 to: =C1/B1
There are times we don't always handle
a certain item so some months will have
a zero in either this month or last months
calc and my % is all messed up i get this
#DIV/0
This is a problem only when B1 is zero. When A1 is zero, your formula will
correctly return -100%.
There is no mathematically correct percentage difference when B1 is zero.
So you need to implement an arbitrary result.
Since going from "n" to zero is -100%, it might seem reasonable to say that
going from zero to "n" is a 100% change. If that is what you want, then:
=if(B1=0,1,C1/B1)
Alternatively, you might simply what to leave D1 blank in that case. If so,
then:
=if(B1 = 0,"",C1/B1)
Caveat: Normally, B1*(1+D1) will equal A1. But that is not the case when
B1 is zero, no matter what choice you make.
|