Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Omega Point
 
Posts: n/a
Default Counting Consecutive Cells that meet Criteria


Hi,

I have a list of numbers for each weekday going back about 4 years and
I want to be able to count the number of times there are two, three,
etc. consecutive days with positive and negative numbers. I then want
to be able to perform basic statistical functions on these numbers.
Here's an example of some of the data:

Jan 1, 2006 $.10
Jan 2, 2006 $.20
Jan 3, 2006 -$.15
Jan 4, 2006 -$.05
Jan 5, 2006 -$.07
Jan 6, 2006 $.12
Jan 7, 2006 -$.03
Jan 8, 2006 $.06
Jan 9, 2006 $.04
Jan 10, 2006 -$.09

I want to count the number of times there are two, three, etc.
consecutive days that there are positive and negative numbers. For
example, in the data above the number of two consecutive days of
positive occurrences would be 2 (Jan 1 and Jan 2 and then again on Jan
8 and Jan 9).

Next, I want to sum the numbers that meet the criteria and determine
averages.

How do I do this in Excel?

Thanks for your help.


--
Omega Point
------------------------------------------------------------------------
Omega Point's Profile: http://www.excelforum.com/member.php...o&userid=31940
View this thread: http://www.excelforum.com/showthread...hreadid=516647

  #2   Report Post  
Posted to microsoft.public.excel.misc
rsenn
 
Posts: n/a
Default Counting Consecutive Cells that meet Criteria


There are probably fancier ways using the OFFSET function, but if you
could create formulas in the next column based on the IF function.

IF( AND (A10 < 0, A11 < 0, A12 < 0), do this, do that)

It looks like you are trying to find out how to get rich by predicting
stock price movements. Let us know if you figure it out.


--
rsenn
------------------------------------------------------------------------
rsenn's Profile: http://www.excelforum.com/member.php...o&userid=29050
View this thread: http://www.excelforum.com/showthread...hreadid=516647

  #3   Report Post  
Posted to microsoft.public.excel.misc
Biff
 
Posts: n/a
Default Counting Consecutive Cells that meet Criteria

Hi!

Here's one way, but it takes several steps to get the desired results.

Assuming there are no empty cells within the range.

Since you're testing for 2 different conditions, consecutive positives and
consecutive negatives, you'll need to do it as separate operations for each
condition.

Assuming the numeric values are in the range B2:Bn. Row 1 are the column
headers and do not contain any numeric values.

For the consecutive positives:

Enter this formula in C2:

=IF(AND(B20,B10),SUM(C1,1),1)

Enter this formula in D2:

=IF(AND(B30,B20),D3,C2)

Select both C2 and D2 and copy down to the end of the data set.

Now, to count how many times a positive number appears in 2 consecutive
cells:

=COUNTIF(C2:Cn,2)

To get the average where 2 consecutive cells are positive:

Array entered using the key combo of CTRL,SHIFT,ENTER:

=AVERAGE(IF(D2:Dn=2,B2:Bn))

For negatives it's the same except you need to change the logical operators
in the formulas in C2 and D2 from greater than , to less than <. (or use a
different range of cells for those calcs)

Biff

"Omega Point"
wrote in message
...

Hi,

I have a list of numbers for each weekday going back about 4 years and
I want to be able to count the number of times there are two, three,
etc. consecutive days with positive and negative numbers. I then want
to be able to perform basic statistical functions on these numbers.
Here's an example of some of the data:

Jan 1, 2006 $.10
Jan 2, 2006 $.20
Jan 3, 2006 -$.15
Jan 4, 2006 -$.05
Jan 5, 2006 -$.07
Jan 6, 2006 $.12
Jan 7, 2006 -$.03
Jan 8, 2006 $.06
Jan 9, 2006 $.04
Jan 10, 2006 -$.09

I want to count the number of times there are two, three, etc.
consecutive days that there are positive and negative numbers. For
example, in the data above the number of two consecutive days of
positive occurrences would be 2 (Jan 1 and Jan 2 and then again on Jan
8 and Jan 9).

Next, I want to sum the numbers that meet the criteria and determine
averages.

How do I do this in Excel?

Thanks for your help.


--
Omega Point
------------------------------------------------------------------------
Omega Point's Profile:
http://www.excelforum.com/member.php...o&userid=31940
View this thread: http://www.excelforum.com/showthread...hreadid=516647



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
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
Counting multiple cells using a criteria John Excel Discussion (Misc queries) 1 June 14th 05 04:51 PM
Counting empty cells within a range of cells Rosehill - ExcelForums.com New Users to Excel 0 April 7th 05 12:47 AM
Print cells that meet conditional formatting criteria Roundy Excel Discussion (Misc queries) 1 December 14th 04 12:13 AM
Counting rows based on criteria in multiple cells Margaret Excel Discussion (Misc queries) 11 December 2nd 04 11:04 PM


All times are GMT +1. The time now is 10:39 AM.

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"