Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Melissa
 
Posts: n/a
Default Count if array contains cells of a certain value

This is an example of my table:
Row No.
1 Value Count
2 FALSE 0
3 FALSE 0
4 TRUE 0 (=countif($B$2:B4,TRUE))
5 FALSE 1 (=countif($B$2:B5,TRUE))
6 FALSE 0
7 TRUE 0
8 FALSE 1 (=countif($B$6:B8,TRUE))
9 TRUE 1 (=countif($B$6:B9,TRUE))

In column C, I want to count how many times the value "True" appears in
column B. But I only want to count from the array that stops the row ABOVE
the current one. The starting cell of the array will remain fixed for 4 rows
then it changes. In my example above, for Row No. 2-5, the starting cell is
$B$2. However, for Row No. -9, the starting cell is $B$6.

I want to copy this formula down 2000+ rows without having to manually
change the starting cell. Can this be done?
  #2   Report Post  
bj
 
Posts: n/a
Default

one way to do it would be to use an equation such as
=countif($A$1:A5,"True")-Count($A$1:A4,"True")
I am not sure from your writeup and example whether you would want this one
in B5 or B6 (B6 I think)
Anyway you can copy this down to end of your data and get zeros and ones.

"Melissa" wrote:

This is an example of my table:
Row No.
1 Value Count
2 FALSE 0
3 FALSE 0
4 TRUE 0 (=countif($B$2:B4,TRUE))
5 FALSE 1 (=countif($B$2:B5,TRUE))
6 FALSE 0
7 TRUE 0
8 FALSE 1 (=countif($B$6:B8,TRUE))
9 TRUE 1 (=countif($B$6:B9,TRUE))

In column C, I want to count how many times the value "True" appears in
column B. But I only want to count from the array that stops the row ABOVE
the current one. The starting cell of the array will remain fixed for 4 rows
then it changes. In my example above, for Row No. 2-5, the starting cell is
$B$2. However, for Row No. -9, the starting cell is $B$6.

I want to copy this formula down 2000+ rows without having to manually
change the starting cell. Can this be done?

  #3   Report Post  
Melissa
 
Posts: n/a
Default

It's v difficult to explain my question, but I'll try harder!
Your formula gives the same result as mine. In your example, if I were to
copy the formula down the 2000 rows, I will get a running total of all "TRUE"
in my column C. This is because my starting cell is $A$1.

If we refer back to my example table below, you can see that my formula for
Row 4 is different from that for Row 8, in that the starting cell is
different. So for Rows 1-4, the starting cell is $B$2 while for rows 6-9,
the starting cell is $B$6.

This change in starting cell occurs at regular intervals of 4 rows (in my
example table).

Any hope here?

"bj" wrote:

one way to do it would be to use an equation such as
=countif($A$1:A5,"True")-Count($A$1:A4,"True")
I am not sure from your writeup and example whether you would want this one
in B5 or B6 (B6 I think)
Anyway you can copy this down to end of your data and get zeros and ones.

"Melissa" wrote:

This is an example of my table:
Row No.
1 Value Count
2 FALSE 0
3 FALSE 0
4 TRUE 0 (=countif($B$2:B4,TRUE))
5 FALSE 1 (=countif($B$2:B5,TRUE))
6 FALSE 0
7 TRUE 0
8 FALSE 1 (=countif($B$6:B8,TRUE))
9 TRUE 1 (=countif($B$6:B9,TRUE))

In column C, I want to count how many times the value "True" appears in
column B. But I only want to count from the array that stops the row ABOVE
the current one. The starting cell of the array will remain fixed for 4 rows
then it changes. In my example above, for Row No. 2-5, the starting cell is
$B$2. However, for Row No. -9, the starting cell is $B$6.

I want to copy this formula down 2000+ rows without having to manually
change the starting cell. Can this be done?

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
Character Count Range of Cells michimac Excel Discussion (Misc queries) 1 May 30th 05 12:26 AM
COUNT NON-BLANK CELLS WITH REFERENCE TO ANOTHER COLUMN carricka Excel Worksheet Functions 1 May 6th 05 05:50 PM
count non blank cells which meet criteria in another column cmarsh5035 Excel Worksheet Functions 2 February 16th 05 05:32 PM
Can I count in an array based on a function? HokieLawrence Excel Worksheet Functions 2 February 12th 05 04:05 AM
Can I count how many grey-filled cells are in a row ? AnthonyG Excel Worksheet Functions 1 February 4th 05 11:08 AM


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