![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 4
|
Is there a way to return a "0" rather than the familiar #DIV/0! in a formula when you are in fact dividing by "0" ?
Any help would be appreciated. Thanks |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
where the denomitor is first tested for being a non-zero number. |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: Midlands, UK
Posts: 217
|
Try this formula, just substitue A1 & B1 for the relevent cell refs or numbers.
=IF(ISERROR(A1/B1),"0.00",A1/B1) |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Most probably
List your formula for better help... =IF(A2=0,0,A1/A2) Tom How's that Mark? _________________ Found a solution? If so, please post again so members of this board can spend their time helping others. Better still, edit your topic(intitial post), by tagging on a word or phrase such as, "Problem Solved", or "Resolved". Thanks for being courteous! [ This Message was edited by: TsTom on 2002-05-08 01:05 ] |
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
|
|
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Apr 2002
Location: Wivenhoe, England
Posts: 877
|
Unless you are sure that only numbers will be put in A1 and A2 it is better to use the ISERROR formula. Otherwise you will get another error message. Eg if you put a number in A1 and Nil in A2 you get the #VALUE! error.
|
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
|
|
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Apr 2002
Location: Wivenhoe, England
Posts: 877
|
Sorry to be contrary Mark but the question was "Is there a way to return a "0" rather than the familiar #DIV/0! in a formula when you are in fact dividing by "0" ? "
It is another matter if you want to be notified of some other error. |
|
|
|
|
|
#9 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
=IF(B1,A1/B1,0) ...is preferrable to all others. |
|
|
|
|
|
|
#10 | ||
|
Board Regular
Join Date: Apr 2002
Location: Wivenhoe, England
Posts: 877
|
Quote:
|
||
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|