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 » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Formula to rid of DIV/o!



 
 
Thread Tools Display Modes
  #21  
Old August 19th, 2004, 06:46 PM
hgrove
external usenet poster
 
Posts: n/a
Default

Frank Kabel wrote...
=IF(COUNTIF($J2:$K2,"0")=2,$K2-$J2,"")


But this formula definetely won't help if K2 contains for example
="". It will also return an error. Of course not on the condition
part but on the TRUE part of the If statement

...

Me bad, didn't test. This could be done with an array formula

=IF(COUNT(1/$J2:$K2)=2,$K2-$J2,"")

So to add an alternative I'd use:
=IF(AND(N(J2),N(K2)),K2-J2,"")


OK, but there just doesn't seem any point to the OP wanting exclude
true numeric zeros as opposed to blanks or nonnumeric text. K2-J2
*can't* throw off errors unless K2 or J2 contains an error or evaluates
to nonnumeric text. If either is numeric zero, there's no error, so it's
highly likely the OP is confusing #DIV/0! errors from dividing by zero,
which does need to be trapped, and #VALUE! errors when subtracting
numbers, which does not need zero trapping but nonnumber trapping.

So we're both still dealing with the symptoms when the cause is that
either cell K2 or cell J2 contains something it oughtn't.


---
Message posted from http://www.ExcelForum.com/

  #22  
Old August 19th, 2004, 11:04 PM
Frank Kabel
external usenet poster
 
Posts: n/a
Default

..

Me bad, didn't test. This could be done with an array formula


This happens so rarely for your formula suggestions :-)


=IF(COUNT(1/$J2:$K2)=2,$K2-$J2,"")


nice idea


So to add an alternative I'd use:
=IF(AND(N(J2),N(K2)),K2-J2,"")


OK, but there just doesn't seem any point to the OP wanting exclude
true numeric zeros as opposed to blanks or nonnumeric text.


You're right. The non-array approach would then probably require
ISNUMBER function calls instead of N() function calls.


So we're both still dealing with the symptoms when the cause is that
either cell K2 or cell J2 contains something it oughtn't.


Ack, but maybe the OP will come back.

Regards
Frank


 




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 08:14 PM.


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