Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Counting Criteria in Cells in Multiple Ranges

I am trying to count the number of times the number 1 appears in a cell in
the same row for multple columns. For example, say I have 4 columns, with
the cell being the number 1 or blank. I need to count every time the number
1 appears in two or more columns in the same row for 400 rows. It seems I
would need it to count using many ranges, from two to ten columns looking for
combinations, e.g., searching range A1:A400 looking for the number 1 and
searching range B1:B400 for the number one, etc., and when it identifies the
number 1 in the same row for 2 or more columns, it would count it. In the
example below the count would be 3 because there were three times when the
number 1 appeared in 2 columns in the same row Rows 1. 4 and 6).

A B C D
1 1 1
2 1
3 1
4 1 1
5 1
6 1 1

I would assume the formula could be expanded to search for a combintation of
"1's" over 10 columns, etc.

Thanks for your help and suggestions.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Counting Criteria in Cells in Multiple Ranges

=SUM(IF(((A1:A6=1)+(B1:B6=1)+(C1:C6=1)+(D1:D6=1)) 1,1))

ctrl+shift+enter, not just enter


"WalterK" wrote:

I am trying to count the number of times the number 1 appears in a cell in
the same row for multple columns. For example, say I have 4 columns, with
the cell being the number 1 or blank. I need to count every time the number
1 appears in two or more columns in the same row for 400 rows. It seems I
would need it to count using many ranges, from two to ten columns looking for
combinations, e.g., searching range A1:A400 looking for the number 1 and
searching range B1:B400 for the number one, etc., and when it identifies the
number 1 in the same row for 2 or more columns, it would count it. In the
example below the count would be 3 because there were three times when the
number 1 appeared in 2 columns in the same row Rows 1. 4 and 6).

A B C D
1 1 1
2 1
3 1
4 1 1
5 1
6 1 1

I would assume the formula could be expanded to search for a combintation of
"1's" over 10 columns, etc.

Thanks for your help and suggestions.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 287
Default Counting Criteria in Cells in Multiple Ranges

Try

=SUMPRODUCT((SUBTOTAL(9,OFFSET(A1:D1,ROW(A1:A400)-ROW(A1),0))1)+0)

You can expand to a 10 column range by changing D1 to J1

"Teethless mama" wrote:

=SUM(IF(((A1:A6=1)+(B1:B6=1)+(C1:C6=1)+(D1:D6=1)) 1,1))

ctrl+shift+enter, not just enter


"WalterK" wrote:

I am trying to count the number of times the number 1 appears in a cell in
the same row for multple columns. For example, say I have 4 columns, with
the cell being the number 1 or blank. I need to count every time the number
1 appears in two or more columns in the same row for 400 rows. It seems I
would need it to count using many ranges, from two to ten columns looking for
combinations, e.g., searching range A1:A400 looking for the number 1 and
searching range B1:B400 for the number one, etc., and when it identifies the
number 1 in the same row for 2 or more columns, it would count it. In the
example below the count would be 3 because there were three times when the
number 1 appeared in 2 columns in the same row Rows 1. 4 and 6).

A B C D
1 1 1
2 1
3 1
4 1 1
5 1
6 1 1

I would assume the formula could be expanded to search for a combintation of
"1's" over 10 columns, etc.

Thanks for your help and suggestions.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Counting Criteria in Cells in Multiple Ranges

A simple & quick way ..
In E1, copied down: = --(COUNTIF(A1:D1,1)=2)
Then in F1: =COUNTIF(E:E,"0")
for the answer
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"WalterK" wrote:
I am trying to count the number of times the number 1 appears in a cell in
the same row for multple columns. For example, say I have 4 columns, with
the cell being the number 1 or blank. I need to count every time the number
1 appears in two or more columns in the same row for 400 rows. It seems I
would need it to count using many ranges, from two to ten columns looking for
combinations, e.g., searching range A1:A400 looking for the number 1 and
searching range B1:B400 for the number one, etc., and when it identifies the
number 1 in the same row for 2 or more columns, it would count it. In the
example below the count would be 3 because there were three times when the
number 1 appeared in 2 columns in the same row Rows 1. 4 and 6).

A B C D
1 1 1
2 1
3 1
4 1 1
5 1
6 1 1

I would assume the formula could be expanded to search for a combintation of
"1's" over 10 columns, etc.

Thanks for your help and suggestions.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Counting Criteria in Cells in Multiple Ranges

For 4 columns:

=SUMPRODUCT(--(MMULT(--(A1:D400=1),{1;1;1;1})1))

For 10 columns:

=SUMPRODUCT(--(MMULT(--(A1:J400=1),{1;1;1;1;1;1;1;1;1;1})1))

--
Biff
Microsoft Excel MVP


"daddylonglegs" wrote in message
...
Try

=SUMPRODUCT((SUBTOTAL(9,OFFSET(A1:D1,ROW(A1:A400)-ROW(A1),0))1)+0)

You can expand to a 10 column range by changing D1 to J1

"Teethless mama" wrote:

=SUM(IF(((A1:A6=1)+(B1:B6=1)+(C1:C6=1)+(D1:D6=1)) 1,1))

ctrl+shift+enter, not just enter


"WalterK" wrote:

I am trying to count the number of times the number 1 appears in a cell
in
the same row for multple columns. For example, say I have 4 columns,
with
the cell being the number 1 or blank. I need to count every time the
number
1 appears in two or more columns in the same row for 400 rows. It
seems I
would need it to count using many ranges, from two to ten columns
looking for
combinations, e.g., searching range A1:A400 looking for the number 1
and
searching range B1:B400 for the number one, etc., and when it
identifies the
number 1 in the same row for 2 or more columns, it would count it. In
the
example below the count would be 3 because there were three times when
the
number 1 appeared in 2 columns in the same row Rows 1. 4 and 6).

A B C D
1 1 1
2 1
3 1
4 1 1
5 1
6 1 1

I would assume the formula could be expanded to search for a
combintation of
"1's" over 10 columns, etc.

Thanks for your help and suggestions.



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
Counting cells in a range per multiple criteria . . . Dano Excel Worksheet Functions 9 May 19th 08 05:28 PM
Counting cells using multiple criteria andrew.curley Excel Worksheet Functions 4 June 12th 06 04:41 PM
Counting multiple cells using a criteria John Excel Discussion (Misc queries) 1 June 14th 05 04:51 PM
Counting Cells with multiple criteria.One criteria supporting wild Azhar Saleem Excel Worksheet Functions 1 January 12th 05 10:54 AM
Counting Cells with multiple criteria.One criteria supporting wild Azhar Arain Excel Worksheet Functions 1 January 12th 05 08:33 AM


All times are GMT +1. The time now is 09:40 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"