Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
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   Report Post  
Posted to microsoft.public.excel.misc
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



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Tables - Variance and Variance % PJS Excel Discussion (Misc queries) 2 January 18th 06 03:12 AM
Percent Variance Formula mdalby Excel Discussion (Misc queries) 1 August 25th 05 05:07 PM
Formula for calculating Variance Lori Lynn Excel Discussion (Misc queries) 2 July 25th 05 08:41 PM
Excel % Variance Formula........ BigDon Excel Worksheet Functions 5 June 7th 05 08:58 PM
Pivot Tables - Variance and % Variance fields CraigS Excel Discussion (Misc queries) 5 January 6th 05 12:22 AM


All times are GMT +1. The time now is 11:42 PM.

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

About Us

"It's about Microsoft Excel"