using countif without a range

hawley

Board Regular
Joined
Apr 7, 2002
Messages
197
I am trying to use a countif statement but I want don't want to look at a whole range just certain cells. I have tried different things but I keep getting an error. Here is something like I am trying.

I just want to look at cells T17, T20 and T30 but nothing in between.
=IF(COUNTIF((T17,T20,T30),"X")>0,"X","no")

If you have any suggestions let me know.
Thanks-
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
The 1st argument of COUNTIF must be a cell range. A cell range is defined as...

"To refer to a range of cells, enter the reference for the cell in the upper-left corner of the range, a colon :)), and then the reference to the cell in the lower-right corner of the range."
 
Upvote 0
On 2002-04-08 09:15, hawley wrote:
I am trying to use a countif statement but I want don't want to look at a whole range just certain cells. I have tried different things but I keep getting an error. Here is something like I am trying.

I just want to look at cells T17, T20 and T30 but nothing in between.
=IF(COUNTIF((T17,T20,T30),"X")>0,"X","no")

If you have any suggestions let me know.
Thanks-

It seems just an "X" in one the target cells is sufficient, to return as result an "X", otherwise a "no".

=IF(SUMPRODUCT((T17="X")+(T20="X")+(T30="X"))>0,"X","no")

would do that job.
 
Upvote 0
On 2002-04-08 09:36, Aladin Akyurek wrote:
On 2002-04-08 09:15, hawley wrote:
I am trying to use a countif statement but I want don't want to look at a whole range just certain cells. I have tried different things but I keep getting an error. Here is something like I am trying.

I just want to look at cells T17, T20 and T30 but nothing in between.
=IF(COUNTIF((T17,T20,T30),"X")>0,"X","no")

If you have any suggestions let me know.
Thanks-

It seems just an "X" in one the target cells is sufficient, to return as result an "X", otherwise a "no".

=IF(SUMPRODUCT((T17="X")+(T20="X")+(T30="X"))>0,"X","no")

would do that job.

To me it looks like hawley wants to evalute a 4 element set consisting of {T17,T20,T30,"X"}.
 
Upvote 0
Oops, I missed the bit about X being in there.

=IF(SUMPRODUCT((T17="X")*(T20="X")*(T30="X"))=1,"X","no")
This message was edited by Al Chara on 2002-04-08 09:54
 
Upvote 0
On 2002-04-08 09:38, Mark W. wrote:
On 2002-04-08 09:36, Aladin Akyurek wrote:
On 2002-04-08 09:15, hawley wrote:
I am trying to use a countif statement but I want don't want to look at a whole range just certain cells. I have tried different things but I keep getting an error. Here is something like I am trying.

I just want to look at cells T17, T20 and T30 but nothing in between.
=IF(COUNTIF((T17,T20,T30),"X")>0,"X","no")

If you have any suggestions let me know.
Thanks-

It seems just an "X" in one the target cells is sufficient, to return as result an "X", otherwise a "no".

=IF(SUMPRODUCT((T17="X")+(T20="X")+(T30="X"))>0,"X","no")

would do that job.

To me it looks like hawley wants to evalute a 4 element set consisting of {T17,T20,T30,"X"}.

If so, I'll try to cope.
 
Upvote 0
Thanks for the help everyone. What I ended up using was this
IF(SUMPRODUCT((T10="X")+(T20="X")+(T30="X"))>0,"X","no")

I also found this will work but the above is less typing.
IF((COUNTIF(T10,"X")+COUNTIF(T20,"X")+COUNTIF(T30,"X"))>0,"X","no")
 
Upvote 0

Forum statistics

Threads
1,214,402
Messages
6,119,299
Members
448,885
Latest member
LokiSonic

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top