View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default #DIV/0! in variance/percentage formula

You say you want 0% if you have 0 in 2008 and 100 in 2009. That wouldn't be
my choice; but the choice is arbitrary.

Assuming that 50 is in A2 and 100 is B2, the formula for C2 (-50%, not -0.5%
by the way):

=if(B2=0, 0, (A2 - B2) / B2)

formatted as Percentage. Copy the formula down.


----- original message -----

"Annette" wrote in message
...
I have tried to figure out how to write this formula so
it will produce either the correct result or show nothing.

Here is an example

2009 2008 % -/+
50.00 100.00 -0.5%
100 0 0%
0 100.00 -100%

I can write =if(sum(cell 1 - cell 2)/cell 2 = "", "", sum(cell 1 - cell
2)/cell 2))
The second row will display #DIV/0!

I would like the second row to display 0 ...

Can someone tell me how to write that formula? Thanks much!

Annette