#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 275
Default Formula help

can anybody give me a formula that will count the number of times the number
"1" shows up in two consecutive rows in a whole column.

eg

1
1

1

1
1
1

1
1

so check the column above and count how many time the number "1" is shown in
two consecutive rows = answer from above would be 2

thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Formula help

Isn't the answer 4 in your example?

Pete

Anthony wrote:
can anybody give me a formula that will count the number of times the number
"1" shows up in two consecutive rows in a whole column.

eg

1
1

1

1
1
1

1
1

so check the column above and count how many time the number "1" is shown in
two consecutive rows = answer from above would be 2

thanks in advance


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 275
Default Formula help

Hi,

err nope answer is two as shown below


1
1 here

1

1
1
1

1
1 ..and here

any help appreciated

"Pete_UK" wrote:

Isn't the answer 4 in your example?

Pete

Anthony wrote:
can anybody give me a formula that will count the number of times the number
"1" shows up in two consecutive rows in a whole column.

eg

1
1

1

1
1
1

1
1

so check the column above and count how many time the number "1" is shown in
two consecutive rows = answer from above would be 2

thanks in advance



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Formula help

Ah, so the three 1's in consecutive columns do not count?

Assuming your first number starts in A2, enter this formula in B3:

=IF(AND(A3=1,A2=1,A4=0,A1=0),1,0)

then copy the formula down the column for as many 1's as you have. Then
just sum column B - you could put this formula in B1:

=SUM(B3:B100)

(or whatever).

Hope this helps.

Pete

Anthony wrote:
Hi,

err nope answer is two as shown below


1
1 here

1

1
1
1

1
1 ..and here

any help appreciated

"Pete_UK" wrote:

Isn't the answer 4 in your example?

Pete

Anthony wrote:
can anybody give me a formula that will count the number of times the number
"1" shows up in two consecutive rows in a whole column.

eg

1
1

1

1
1
1

1
1

so check the column above and count how many time the number "1" is shown in
two consecutive rows = answer from above would be 2

thanks in advance




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Formula help

I meant consecutive "rows", but posted too quickly!.

Pete

Pete_UK wrote:
Ah, so the three 1's in consecutive columns do not count?

Assuming your first number starts in A2, enter this formula in B3:

=IF(AND(A3=1,A2=1,A4=0,A1=0),1,0)

then copy the formula down the column for as many 1's as you have. Then
just sum column B - you could put this formula in B1:

=SUM(B3:B100)

(or whatever).

Hope this helps.

Pete

Anthony wrote:
Hi,

err nope answer is two as shown below


1
1 here

1

1
1
1

1
1 ..and here

any help appreciated

"Pete_UK" wrote:

Isn't the answer 4 in your example?

Pete

Anthony wrote:
can anybody give me a formula that will count the number of times the number
"1" shows up in two consecutive rows in a whole column.

eg

1
1

1

1
1
1

1
1

so check the column above and count how many time the number "1" is shown in
two consecutive rows = answer from above would be 2

thanks in advance





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Formula help

Maybe something like this?:

With
digits, or blanks in A1:A10

This formula counts the occurrences of exactly 2 consecutive 1's, bounded by
non-1's:

B1:
=((A1=1)*(A2=1)*(A3<1))+SUMPRODUCT((A1:A10<1)*(A 2:A11=1)*(A3:A12=1)*(A4:A13<1))

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Anthony" wrote:

Hi,

err nope answer is two as shown below


1
1 here

1

1
1
1

1
1 ..and here

any help appreciated

"Pete_UK" wrote:

Isn't the answer 4 in your example?

Pete

Anthony wrote:
can anybody give me a formula that will count the number of times the number
"1" shows up in two consecutive rows in a whole column.

eg

1
1

1

1
1
1

1
1

so check the column above and count how many time the number "1" is shown in
two consecutive rows = answer from above would be 2

thanks in advance



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 275
Default Formula help

thanks for all ur help guys!

"Ron Coderre" wrote:

Maybe something like this?:

With
digits, or blanks in A1:A10

This formula counts the occurrences of exactly 2 consecutive 1's, bounded by
non-1's:

B1:
=((A1=1)*(A2=1)*(A3<1))+SUMPRODUCT((A1:A10<1)*(A 2:A11=1)*(A3:A12=1)*(A4:A13<1))

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Anthony" wrote:

Hi,

err nope answer is two as shown below


1
1 here

1

1
1
1

1
1 ..and here

any help appreciated

"Pete_UK" wrote:

Isn't the answer 4 in your example?

Pete

Anthony wrote:
can anybody give me a formula that will count the number of times the number
"1" shows up in two consecutive rows in a whole column.

eg

1
1

1

1
1
1

1
1

so check the column above and count how many time the number "1" is shown in
two consecutive rows = answer from above would be 2

thanks in advance


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
Reusing formula Tony29 Excel Discussion (Misc queries) 7 September 7th 06 03:34 AM
2 Nesting questions Starchaser Excel Worksheet Functions 7 January 20th 06 06:53 PM
Match then lookup Tenacity Excel Worksheet Functions 9 December 3rd 05 05:30 AM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM


All times are GMT +1. The time now is 01:00 PM.

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"