Trouble with IF statement :: MrExcel Message Board



 FAQFAQ
   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   StatisticsStatistics 
 RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Online StoreOnline Store

MrExcel Message Board Forum Index -> Excel Questions

Trouble with IF statement
Post new topic   Reply to topic
Last Thread | Next Thread  >   Printable version
  Author    Thread

garender
Welcome to the Board


Joined: 18 Aug 2003
Posts: 2

Flag: Usa

Status: Offline

 Reply with quote  

Trouble with IF statement

I'm trying not to value a cell when either 1 of 2 cells =0. For example, in trying to determine a gross collection % for the following cell values: Col D:Payments =0.0, Col F:adjustments=2000.00, and Col H: charges=5000.00. My formula =IF ((d5=0),"",(d5/h5)) displays a blank which is o.k., but when Col D: Payments =1000.00, Col F: adjustments=2000.00 and Col H: charges = 0.0 the formular returns a #DIV/0!.

I wanted to consider either cell D or cell H containing a zero and returning a blank. Thanks.

Post Fri Sep 19, 2003 7:13 pm 
 View user's profile Send private message

kskinne
Board Master


Joined: 18 Feb 2002
Posts: 948

Flag: Blank

Status: Offline

 Reply with quote  

Re: Trouble with IF statement

try this:

=IF(OR(D5=0,H5=0),"",(D5/H5))

hth
kevin

Post Fri Sep 19, 2003 7:20 pm 
 View user's profile Send private message

just_jon
MrExcel MVP


Joined: 04 Sep 2002
Posts: 4007
Location: Huntsville AL
Flag: Blank

Status: Offline

 Reply with quote  

Re: Trouble with IF statement

Something like this, perhaps --

Microsoft Excel - Price Comparisons.xls___Running: xl2000 : OS = Windows ME
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)bout
=

D
E
F
G
H
I
1
10   52
2
22   112
3
99   0 
4
0   99 
5
      
Sheet2 

[HtmlMaker 2.40] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.

_________________
just_jon
Book of the Month: I'm Not Really an MVP, I Just Play One on TV [j. jon, 2004]

Post Fri Sep 19, 2003 7:23 pm 
 View user's profile Send private message

Mat
Board Master


Joined: 17 Sep 2003
Posts: 451
Location: Montréal, Québec
Flag: Canada

Status: Offline

 Reply with quote  

Re: Trouble with IF statement

You should use something like this :

=IF(OR(D5=0;H5=0);"";D5/H5)

Post Fri Sep 19, 2003 7:25 pm 
 View user's profile Send private message

Mark W.
MrExcel MVP


Joined: 11 Feb 2002
Posts: 7146
Location: Austin, Texas USA
Flag: Usa

Status: Offline

 Reply with quote  

Re: Trouble with IF statement

You can avoid #DIV/0! simply by evaluating the denominator...

=IF(H5,D5/H5,"")

Post Fri Sep 19, 2003 7:38 pm 
 View user's profile Send private message
  Display posts from previous:      

MrExcel Message Board Forum Index -> Excel Questions


Forum Jump:
Jump to:  

Post new topic   Reply to topic
Page 1 of 1



Add To Favorites

 


Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB: 2.0.4 © 2001 phpBB Group

Need help posting your first question? Read how to post

Need extra help ? Couldn't get the answer you needed ? Get a free quote from our Consulting Team

Download Colo's HTML Maker utility for displaying your Excel Worksheet on the board.

Download VB HTML Maker to post your code on the board


Check out our new index to 485 Excel Articles.


Return to MrExcel Consulting

All contents Copyright 1998-2004 by MrExcel.com
If you believe information posted here is from your copyrighted source, notify us per the Terms of Use
Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.