#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Dividing by Zero

If I have 8 in A1 and 2 in A2 I get 25%.

But if I have 8 in A1 and 0 in A2 I get #DIV/0!. When I want to get 0
or 0%.

Simple remedy?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Dividing by Zero

Use a formula like

=IF(A2=0,0,A1/A2)



"TomRW" wrote in message
...
If I have 8 in A1 and 2 in A2 I get 25%.

But if I have 8 in A1 and 0 in A2 I get #DIV/0!. When I want to get 0
or 0%.

Simple remedy?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 149
Default Dividing by Zero

=IF(A2 = 0, 0, A1/A2)

--
HTH,
George


"TomRW" wrote in message
...
If I have 8 in A1 and 2 in A2 I get 25%.

But if I have 8 in A1 and 0 in A2 I get #DIV/0!. When I want to get 0
or 0%.

Simple remedy?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Dividing by Zero

I'm intrigued as to what formula you are using that gives those results? If
you've got 8 in A1 and 2 in A2, then the most obvious formula to give 25%
would be =A2/A1, but if that is the formula you wouldn't get a #DIV/0! when
A2 is 0. If you are trying to protect against A1 (rather than A2) being
zero, then you could use =IF(A1=0,0,A2/A1), but be careful if you use that
formula, as you wouldn't see the difference in result between A1 being zero
and A2 being zero. As you reduce the value of A1, the result of the
division increases, but you have asked for it to reduce again when you get
to A1 being zero; the result of the division should be infinite, not zero,
so make sure that you don't confuse yourself.
--
David Biddulph

"TomRW" wrote in message
...
If I have 8 in A1 and 2 in A2 I get 25%.

But if I have 8 in A1 and 0 in A2 I get #DIV/0!. When I want to get 0
or 0%.

Simple remedy?



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
Dividing name kd Excel Worksheet Functions 1 April 19th 07 04:48 AM
Dividing up cells koba Excel Discussion (Misc queries) 2 April 5th 06 08:50 AM
Dividing by zero careyc Excel Discussion (Misc queries) 5 March 17th 06 11:03 PM
dividing columns by 100 Sgian Excel Discussion (Misc queries) 2 April 22nd 05 02:37 PM
dividing a row LostNFound Excel Worksheet Functions 2 March 7th 05 05:49 PM


All times are GMT +1. The time now is 09:56 AM.

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

About Us

"It's about Microsoft Excel"