A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#DIV/0! in variance/percentage formula



 
 
Thread Tools Display Modes
  #1  
Old September 4th, 2009, 10:52 PM posted to microsoft.public.excel.misc
Annette[_6_]
external usenet poster
 
Posts: 11
Default #DIV/0! in variance/percentage formula

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


  #2  
Old September 4th, 2009, 10:56 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default #DIV/0! in variance/percentage formula

First, you don't need that =sum() function in your formula:

=if(b2=0,"",(a2-b2)/b2)

As long as those cells are numeric or empty.



Annette wrote:

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


--

Dave Peterson
  #3  
Old September 4th, 2009, 11:39 PM posted to microsoft.public.excel.misc
joeu2004
external usenet poster
 
Posts: 1,748
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



  #4  
Old September 4th, 2009, 11:54 PM posted to microsoft.public.excel.misc
Shane Devenshire[_3_]
external usenet poster
 
Posts: 3,333
Default #DIV/0! in variance/percentage formula

Hi,

A few unrelated comment don't write formula which some single numbers:

=SUM(A1-B1) wastes typing time, and computer power and makes your
spreadsheet larger.

Suppose A1 is 50 and B1 is 25, the first thing Excel does in calculate 50-25
which is 25. Then you ask Excel to SUM 25, well the some on any single
number is itself!


--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Annette" wrote:

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



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.