Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Need a formula to count values in different rows

I have two rows, and I want to add the total number of columns which have a 1
in them, over both rows.

1 0 0 1 1 0
1 1 0 0 1 1

So if a 1 occurs whether in one or both rows, it still counts as 1. So here
the count would be 5.

I cant get my head around it at all!!! Please help!


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Need a formula to count values in different rows

One way:

in the row below enter:

A3: =--OR(A1,A2)

and then copy across to F3, then you can just:

=SUM(A3:F3)

Hope this helps.

Pete

On Apr 10, 10:34 am, ceri_m wrote:
I have two rows, and I want to add the total number of columns which have a 1
in them, over both rows.

1 0 0 1 1 0
1 1 0 0 1 1

So if a 1 occurs whether in one or both rows, it still counts as 1. So here
the count would be 5.

I can't get my head around it at all!!! Please help!


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Need a formula to count values in different rows

I think this does what you want...

=SUMPRODUCT(--((A1:Z1+A2:Z2)0))

Rick


"ceri_m" wrote in message
...
I have two rows, and I want to add the total number of columns which have a
1
in them, over both rows.

1 0 0 1 1 0
1 1 0 0 1 1

So if a 1 occurs whether in one or both rows, it still counts as 1. So
here
the count would be 5.

I cant get my head around it at all!!! Please help!



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Need a formula to count values in different rows

Thanks for you help guys - Rick's worked best for what I was after, Mike- for
soem reason it was giving me an answer of 0 with your formula, and Pete's it
came with #value. But it's sorted now, so thank you all! :)

"Rick Rothstein (MVP - VB)" wrote:

I think this does what you want...

=SUMPRODUCT(--((A1:Z1+A2:Z2)0))

Rick


"ceri_m" wrote in message
...
I have two rows, and I want to add the total number of columns which have a
1
in them, over both rows.

1 0 0 1 1 0
1 1 0 0 1 1

So if a 1 occurs whether in one or both rows, it still counts as 1. So
here
the count would be 5.

I cant get my head around it at all!!! Please help!




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Need a formula to count values in different rows

Try

=SUMPRODUCT((A3:F3=1)*(A4:F4=1))

With the ranges suitable adjusted.

Mike

"ceri_m" wrote:

I have two rows, and I want to add the total number of columns which have a 1
in them, over both rows.

1 0 0 1 1 0
1 1 0 0 1 1

So if a 1 occurs whether in one or both rows, it still counts as 1. So here
the count would be 5.

I cant get my head around it at all!!! Please help!




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Need a formula to count values in different rows

Well that's what you dont want!!

Try this instead

=COUNTIF(A3:F3,"=1")+SUMPRODUCT((A4:F4=1)*(A3:F3< 1))


Mike

"Mike H" wrote:

Try

=SUMPRODUCT((A3:F3=1)*(A4:F4=1))

With the ranges suitable adjusted.

Mike

"ceri_m" wrote:

I have two rows, and I want to add the total number of columns which have a 1
in them, over both rows.

1 0 0 1 1 0
1 1 0 0 1 1

So if a 1 occurs whether in one or both rows, it still counts as 1. So here
the count would be 5.

I cant get my head around it at all!!! Please help!


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 202
Default Need a formula to count values in different rows

If you do not want to use another row you could use this
=12-COUNTIF(A1:F2,1)
where 12 is the total number of 0's and 1's in your example

"ceri_m" wrote:

I have two rows, and I want to add the total number of columns which have a 1
in them, over both rows.

1 0 0 1 1 0
1 1 0 0 1 1

So if a 1 occurs whether in one or both rows, it still counts as 1. So here
the count would be 5.

I cant get my head around it at all!!! Please help!


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 202
Default Need a formula to count values in different rows

Forget my post, it does not work

"ceri_m" wrote:

I have two rows, and I want to add the total number of columns which have a 1
in them, over both rows.

1 0 0 1 1 0
1 1 0 0 1 1

So if a 1 occurs whether in one or both rows, it still counts as 1. So here
the count would be 5.

I cant get my head around it at all!!! Please help!


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
Paste Values in Number of rows as count in other sheet Salman Excel Discussion (Misc queries) 0 February 27th 07 06:04 AM
Formula to count values in two columns JBurlage Excel Discussion (Misc queries) 6 August 31st 06 12:59 PM
Count on multiple values with duplicate rows Carla Excel Worksheet Functions 1 November 22nd 05 09:25 PM
How to Count Rows with defined values in multiple columns ryesworld Excel Worksheet Functions 9 November 8th 05 06:32 PM
Getting Count field to recognise rows with negative values in Exc. hamish Excel Worksheet Functions 2 June 20th 05 05:06 AM


All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"