Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Patrick Simonds
 
Posts: n/a
Default IF Statement question

How can I construct an IF Statement that would perform the calculation below
only if all the referenced cells contained numbers? If any cell contains
text I do not want the IF Statement to return a blank cell.

=BX23-BQ23-BP23-BO23-BN23


  #2   Report Post  
Patrick Simonds
 
Posts: n/a
Default

I should have said I want the IF Statement to return a blank cell if there
is text in any of the referenced cells.


"Patrick Simonds" wrote in message
...
How can I construct an IF Statement that would perform the calculation
below only if all the referenced cells contained numbers? If any cell
contains text I do not want the IF Statement to return a blank cell.

=BX23-BQ23-BP23-BO23-BN23



  #3   Report Post  
CLR
 
Posts: n/a
Default

I'm not sure exactly what all you want........but this formula may help get
you started..........

=IF(COUNT(BN23,BO23,BP23,BQ23,BX23)=5,PutYourFormu laHere,"NotAll5CellsAreNum
bers")

Vaya con Dios,
Chuck, CABGx3



"Patrick Simonds" wrote in message
...
How can I construct an IF Statement that would perform the calculation

below
only if all the referenced cells contained numbers? If any cell contains
text I do not want the IF Statement to return a blank cell.

=BX23-BQ23-BP23-BO23-BN23




  #4   Report Post  
CLR
 
Posts: n/a
Default

Well then..........maybe this.......

=IF(OR(ISTEXT(BN23),ISTEXT(BO23),ISTEXT(BP23),ISTE XT(BQ23),ISTEXT(BX23)),"",
PutYourFormulaHere)

or this

=IF(COUNTA(BN23:BQ23,BX23)COUNT(BN23:BQ23,BX23)," ",PutYourFormulaHere)

Vaya con Dios,
Chuck, CABGx3



"Patrick Simonds" wrote in message
...
I should have said I want the IF Statement to return a blank cell if there
is text in any of the referenced cells.


"Patrick Simonds" wrote in message
...
How can I construct an IF Statement that would perform the calculation
below only if all the referenced cells contained numbers? If any cell
contains text I do not want the IF Statement to return a blank cell.

=BX23-BQ23-BP23-BO23-BN23





  #5   Report Post  
Harlan Grove
 
Posts: n/a
Default

"CLR" wrote...
Well then..........maybe this.......

=IF(OR(ISTEXT(BN23),ISTEXT(BO23),ISTEXT(BP23),IST EXT(BQ23),ISTEXT(BX23)),""

,
PutYourFormulaHere)


This works.

or this

=IF(COUNTA(BN23:BQ23,BX23)COUNT(BN23:BQ23,BX23), "",PutYourFormulaHere)

....

This may not work if the OP wants to exclude cells containing boolean or
error values, which aren't text but would be counted by COUNTA. For that
matter, it fails when all cells are blank.

Try

=IF(COUNTIF(BN23:BQ23,"*")+ISTEXT(BX23)=5,PutYourF ormulaHere,"")




  #6   Report Post  
CLR
 
Posts: n/a
Default

Thanks Harlan for drawing to my attention that I had not fully tested my
formulas, and left a couple of holes in them. I answered too quickly
without studying the whole criteria(s). I respectfully apologize to the OP
for that. After re-reading both of the OP's posts in this thread and doing
additional testing, I now submit the following.........

=IF(COUNTA(BN23:BQ23,BX23)COUNT(BN23:BQ23,BX23)," ",IF((COUNT(BN23:BQ23)+COU
NT(BX23))=5,BX23-BQ23-BP23-BO23-BN23,""))

of, if the cells of interest were collected into a Non-contiguious RangeName
"OPrange"........

=IF(COUNTA(OPrange)COUNT(OPrange),"",IF(COUNT(OPr ange)=5,BX23-BQ23-BP23-BO2
3-BN23,""))

Vaya con Dios,
Chuck, CABGx3



"Harlan Grove" wrote in message
...
"CLR" wrote...
Well then..........maybe this.......


=IF(OR(ISTEXT(BN23),ISTEXT(BO23),ISTEXT(BP23),IST EXT(BQ23),ISTEXT(BX23)),""
,
PutYourFormulaHere)


This works.

or this

=IF(COUNTA(BN23:BQ23,BX23)COUNT(BN23:BQ23,BX23), "",PutYourFormulaHere)

...

This may not work if the OP wants to exclude cells containing boolean or
error values, which aren't text but would be counted by COUNTA. For that
matter, it fails when all cells are blank.

Try

=IF(COUNTIF(BN23:BQ23,"*")+ISTEXT(BX23)=5,PutYourF ormulaHere,"")




  #7   Report Post  
Harlan Grove
 
Posts: n/a
Default

"CLR" wrote...
....
=IF(COUNTA(BN23:BQ23,BX23)COUNT(BN23:BQ23,BX23), "",IF((COUNT(BN23:BQ23)
+COUNT(BX23))=5,BX23-BQ23-BP23-BO23-BN23,""))


In the 2nd IF call, why (COUNT(BN23:BQ23)+COUNT(BX23))=5 rather than just
COUNT(BN23:BQ23,BX23)=5 ?

of, if the cells of interest were collected into a Non-contiguious

RangeName
"OPrange"........

=IF(COUNTA(OPrange)COUNT(OPrange),"",IF(COUNT(OP range)=5,BX23-BQ23-BP23
-BO23-BN23,""))

....

If the OP's original specs are correct, then

=IF(COUNT(OPrange)=5,formula,"")

would be sufficient. If COUNT(OPrange)=5 were true, COUNTA(.)COUNT(.) would
always be FALSE, so the outer IF() serves no purpose.

If the supplemental specs really mean only return "" when any of the cells
in OPrange are text (not booleans or errors), your formulas above don't do
that.


  #8   Report Post  
CLR
 
Posts: n/a
Default

Hi Harlan........

First off.........since both the original and the supplemented specs from
the OP were not the clearest, I think we have given him sufficient options
to decide if any one of them will work for him or at least enough ammo to be
able to come back with more specifics of his problem.

Next.............I truely appreciate you taking your time to help give me a
better understanding of these functions. I learn more and more each time I
come to these newsgroups, either to post an original question, or when I try
to help others. Given the opportunity to have constructive dialogue with
one of your stature is a real honor.

"Harlan Grove" said:
In the 2nd IF call, why (COUNT(BN23:BQ23)+COUNT(BX23))=5 rather than just
COUNT(BN23:BQ23,BX23)=5 ?

Chuck's comment: No good reason at all, it's just what came to mind........
your suggestion is obviously better

"Harlan Grove" said:
If the OP's original specs are correct, then
=IF(COUNT(OPrange)=5,formula,"") would be sufficient.
If COUNT(OPrange)=5 were true, COUNTA(.)COUNT(.) would
always be FALSE, so the outer IF() serves no purpose.

Chuck's comment: I stand in awe, this is really really neat!


"Harlan Grove" said:
If the supplemental specs really mean only return "" when any of the cells
in OPrange are text (not booleans or errors), your formulas above don't do
that.

Chuck's comment: Uh-huh, in retrospect I can see how one might conclude
that, but I didn't really take it that way. I figured he wanted an answer
only if he had numbers in all five cells, else "".


Once again, thank you Harlan for your time and patience in helping me along.

Vaya con Dios,
Chuck, CABGx3




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
IF Statement question gryfon Excel Worksheet Functions 6 May 4th 05 09:21 AM
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
How to calculate a sum as one outcome of an IF statement barb in NC Excel Worksheet Functions 2 March 31st 05 08:01 PM
If Statement Question carl Excel Worksheet Functions 1 March 11th 05 04:55 AM
An easy macro question and one I believe to be a little more diffi TroutKing Excel Worksheet Functions 3 January 18th 05 09:17 PM


All times are GMT +1. The time now is 06:11 AM.

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"