#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 130
Default Countif

This is a basic example of a problem I have run into.

I have one column, 10 rows deep. Each cell in the ten cells have the letter
X in it. I only want to count how many X's there are in the 1st,3rd,5th,7th
and 9th row. Countif requires a range I believe and does not allow seperate
multiple cells. Are there any other methods of doing this count.
  #2   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Countif

One possibility, assuming data is in A4:A13 and you want to evaluate the 1,
3, 5, 7, and 9th rows:

=SUMPRODUCT(--(MOD(ROW(A4:A13)-ROW(A4)+1,2)<0),
LEN(A4:A13)-LEN(SUBSTITUTE(A4:A13,"x","")))

If you want the even rows change <0 to =0

"Shu of AZ" wrote:

This is a basic example of a problem I have run into.

I have one column, 10 rows deep. Each cell in the ten cells have the letter
X in it. I only want to count how many X's there are in the 1st,3rd,5th,7th
and 9th row. Countif requires a range I believe and does not allow seperate
multiple cells. Are there any other methods of doing this count.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 130
Default Countif

In the real worksheet, the rows are random and there are 300 of them. I need
to be able to select which rows I need to evaluate and they have no specific
pattern. " 1,4,5,12,17,and so on."

"JMB" wrote:

One possibility, assuming data is in A4:A13 and you want to evaluate the 1,
3, 5, 7, and 9th rows:

=SUMPRODUCT(--(MOD(ROW(A4:A13)-ROW(A4)+1,2)<0),
LEN(A4:A13)-LEN(SUBSTITUTE(A4:A13,"x","")))

If you want the even rows change <0 to =0

"Shu of AZ" wrote:

This is a basic example of a problem I have run into.

I have one column, 10 rows deep. Each cell in the ten cells have the letter
X in it. I only want to count how many X's there are in the 1st,3rd,5th,7th
and 9th row. Countif requires a range I believe and does not allow seperate
multiple cells. Are there any other methods of doing this count.

  #4   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Countif

That's the problem with "examples" of your data that aren't. Details are
always important.

Let's say you want rows 1, 4, 7, and 9, try:
=SUMPRODUCT(--(ISNUMBER(MATCH(ROW(A4:A13)-ROW(A4)+1,{1,4,7,9},0))),
LEN(A4:A13)-LEN(SUBSTITUTE(A4:A13,"x","")))

I'm assuming 1,4,7,and 9 are the index number of the items in your table,
not the actual row numbers (ie - the first row of your table could be in cell
A9).

If you are after the actual row numbers 1,4,7,9 use
=SUMPRODUCT(--(ISNUMBER(MATCH(ROW(A4:A13),{1,4,7,9},0))),
LEN(A4:A13)-LEN(SUBSTITUTE(A4:A13,"x","")))

in either case change {1,4,7,9} to whatever you want.


"Shu of AZ" wrote:

In the real worksheet, the rows are random and there are 300 of them. I need
to be able to select which rows I need to evaluate and they have no specific
pattern. " 1,4,5,12,17,and so on."

"JMB" wrote:

One possibility, assuming data is in A4:A13 and you want to evaluate the 1,
3, 5, 7, and 9th rows:

=SUMPRODUCT(--(MOD(ROW(A4:A13)-ROW(A4)+1,2)<0),
LEN(A4:A13)-LEN(SUBSTITUTE(A4:A13,"x","")))

If you want the even rows change <0 to =0

"Shu of AZ" wrote:

This is a basic example of a problem I have run into.

I have one column, 10 rows deep. Each cell in the ten cells have the letter
X in it. I only want to count how many X's there are in the 1st,3rd,5th,7th
and 9th row. Countif requires a range I believe and does not allow seperate
multiple cells. Are there any other methods of doing this count.

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
sumproduct vs. countif Coal Miner Excel Discussion (Misc queries) 1 June 15th 06 09:34 PM
Countif Formula /Sort Bug??? orcfodder Excel Discussion (Misc queries) 2 January 12th 06 10:04 AM
COUNTIF or not to COUNTIF on a range in another sheet Ellie Excel Worksheet Functions 4 September 15th 05 10:06 PM
Combining IF and COUNTIF based on two columns maxtrixx Excel Discussion (Misc queries) 5 March 31st 05 06:21 PM
Countif - Countif maswinney Excel Worksheet Functions 3 November 15th 04 11:06 PM


All times are GMT +1. The time now is 08:19 PM.

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"