Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JP JP is offline
external usenet poster
 
Posts: 103
Default How to count the maximum number of consecutives?

I need to determine the maximum number of consecutive negative numbers in a
column. The column contains formulas that evaluate to a positive number, a
negative number, zero or "" (blank). I cannot add an additional column. The
following are the results of formulas in cells A1:A11 that need a formula in
A12 that evaluates to 3, the maximum number of consecutive negative numbers
counting cells A2, A6 and A7.

1
-2
""
""
""
-6
-7
8
-9
""
-11

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,203
Default How to count the maximum number of consecutives?

You're sure you can't us an extra column somewhere?? Even a hidden one?
There are many examples of how to do this published on the internet (search
for a phrase like "find sequence of negative numbers in excel" and you'll see
them). But almost all involve a 'helper' column. My own solution required a
helper column also, and I was looking for one without it.
Could you accept a User Defined Function (a VB macro that you can use on a
worksheet just like a built in function)?


"JP" wrote:

I need to determine the maximum number of consecutive negative numbers in a
column. The column contains formulas that evaluate to a positive number, a
negative number, zero or "" (blank). I cannot add an additional column. The
following are the results of formulas in cells A1:A11 that need a formula in
A12 that evaluates to 3, the maximum number of consecutive negative numbers
counting cells A2, A6 and A7.

1
-2
""
""
""
-6
-7
8
-9
""
-11

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JP JP is offline
external usenet poster
 
Posts: 103
Default How to count the maximum number of consecutives?

Thanks very much for your reply but I can't use a hidden column and I need to
avoid user-defined functions and macros. If it is not possible using a
formula or array formula, then at least I'll know that and can stop
trying--so I appreciate your help.

"JLatham" wrote:

You're sure you can't us an extra column somewhere?? Even a hidden one?
There are many examples of how to do this published on the internet (search
for a phrase like "find sequence of negative numbers in excel" and you'll see
them). But almost all involve a 'helper' column. My own solution required a
helper column also, and I was looking for one without it.
Could you accept a User Defined Function (a VB macro that you can use on a
worksheet just like a built in function)?


"JP" wrote:

I need to determine the maximum number of consecutive negative numbers in a
column. The column contains formulas that evaluate to a positive number, a
negative number, zero or "" (blank). I cannot add an additional column. The
following are the results of formulas in cells A1:A11 that need a formula in
A12 that evaluates to 3, the maximum number of consecutive negative numbers
counting cells A2, A6 and A7.

1
-2
""
""
""
-6
-7
8
-9
""
-11

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,203
Default How to count the maximum number of consecutives?

As you now know, there's almost always a solution (key word 'almost'), and in
this case I just kind of figured if Biff couldn't do it, it couldn't be done.
Glad he was able to solve your problem.

"JP" wrote:

Thanks very much for your reply but I can't use a hidden column and I need to
avoid user-defined functions and macros. If it is not possible using a
formula or array formula, then at least I'll know that and can stop
trying--so I appreciate your help.

"JLatham" wrote:

You're sure you can't us an extra column somewhere?? Even a hidden one?
There are many examples of how to do this published on the internet (search
for a phrase like "find sequence of negative numbers in excel" and you'll see
them). But almost all involve a 'helper' column. My own solution required a
helper column also, and I was looking for one without it.
Could you accept a User Defined Function (a VB macro that you can use on a
worksheet just like a built in function)?


"JP" wrote:

I need to determine the maximum number of consecutive negative numbers in a
column. The column contains formulas that evaluate to a positive number, a
negative number, zero or "" (blank). I cannot add an additional column. The
following are the results of formulas in cells A1:A11 that need a formula in
A12 that evaluates to 3, the maximum number of consecutive negative numbers
counting cells A2, A6 and A7.

1
-2
""
""
""
-6
-7
8
-9
""
-11

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How to count the maximum number of consecutives?

Try this array formula** :

=MAX(FREQUENCY(IF(A1:A11<0,ROW(A1:A11)),IF(A1:A11 =0,IF(A1:A11<"",ROW(A1:A11)))))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"JP" wrote in message
...
I need to determine the maximum number of consecutive negative numbers in a
column. The column contains formulas that evaluate to a positive number,
a
negative number, zero or "" (blank). I cannot add an additional column.
The
following are the results of formulas in cells A1:A11 that need a formula
in
A12 that evaluates to 3, the maximum number of consecutive negative
numbers
counting cells A2, A6 and A7.

1
-2
""
""
""
-6
-7
8
-9
""
-11





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JP JP is offline
external usenet poster
 
Posts: 103
Default How to count the maximum number of consecutives?

Thank you for your reply. This is the type of solution I've been looking for
but it evaluates incorrectly to 2 rather than 3 (using my example).

"T. Valko" wrote:

Try this array formula** :

=MAX(FREQUENCY(IF(A1:A11<0,ROW(A1:A11)),IF(A1:A11 =0,IF(A1:A11<"",ROW(A1:A11)))))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"JP" wrote in message
...
I need to determine the maximum number of consecutive negative numbers in a
column. The column contains formulas that evaluate to a positive number,
a
negative number, zero or "" (blank). I cannot add an additional column.
The
following are the results of formulas in cells A1:A11 that need a formula
in
A12 that evaluates to 3, the maximum number of consecutive negative
numbers
counting cells A2, A6 and A7.

1
-2
""
""
""
-6
-7
8
-9
""
-11



.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JP JP is offline
external usenet poster
 
Posts: 103
Default How to count the maximum number of consecutives?

My error, it evaluates perfectly. Thank you so much, T. Valko! I've been
working on this for a long time and it's finally solved thanks to you.

Best regards,
JP

"JP" wrote:

Thank you for your reply. This is the type of solution I've been looking for
but it evaluates incorrectly to 2 rather than 3 (using my example).

"T. Valko" wrote:

Try this array formula** :

=MAX(FREQUENCY(IF(A1:A11<0,ROW(A1:A11)),IF(A1:A11 =0,IF(A1:A11<"",ROW(A1:A11)))))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"JP" wrote in message
...
I need to determine the maximum number of consecutive negative numbers in a
column. The column contains formulas that evaluate to a positive number,
a
negative number, zero or "" (blank). I cannot add an additional column.
The
following are the results of formulas in cells A1:A11 that need a formula
in
A12 that evaluates to 3, the maximum number of consecutive negative
numbers
counting cells A2, A6 and A7.

1
-2
""
""
""
-6
-7
8
-9
""
-11



.

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JP JP is offline
external usenet poster
 
Posts: 103
Default How to count the maximum number of consecutives?

This works perfectly, many many thanks and happy New Year to you.

"T. Valko" wrote:

Try this array formula** :

=MAX(FREQUENCY(IF(A1:A11<0,ROW(A1:A11)),IF(A1:A11 =0,IF(A1:A11<"",ROW(A1:A11)))))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"JP" wrote in message
...
I need to determine the maximum number of consecutive negative numbers in a
column. The column contains formulas that evaluate to a positive number,
a
negative number, zero or "" (blank). I cannot add an additional column.
The
following are the results of formulas in cells A1:A11 that need a formula
in
A12 that evaluates to 3, the maximum number of consecutive negative
numbers
counting cells A2, A6 and A7.

1
-2
""
""
""
-6
-7
8
-9
""
-11



.

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JP JP is offline
external usenet poster
 
Posts: 103
Default How to count the maximum number of consecutives?

I finally understand how this is working. It's a brilliant and elegant
solution that is greatly appreciated. Thanks once again, Biff and happy
trails.

JP


"T. Valko" wrote:

Try this array formula** :

=MAX(FREQUENCY(IF(A1:A11<0,ROW(A1:A11)),IF(A1:A11 =0,IF(A1:A11<"",ROW(A1:A11)))))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"JP" wrote in message
...
I need to determine the maximum number of consecutive negative numbers in a
column. The column contains formulas that evaluate to a positive number,
a
negative number, zero or "" (blank). I cannot add an additional column.
The
following are the results of formulas in cells A1:A11 that need a formula
in
A12 that evaluates to 3, the maximum number of consecutive negative
numbers
counting cells A2, A6 and A7.

1
-2
""
""
""
-6
-7
8
-9
""
-11



.

  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How to count the maximum number of consecutives?

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"JP" wrote in message
...
I finally understand how this is working. It's a brilliant and elegant
solution that is greatly appreciated. Thanks once again, Biff and happy
trails.

JP


"T. Valko" wrote:

Try this array formula** :

=MAX(FREQUENCY(IF(A1:A11<0,ROW(A1:A11)),IF(A1:A11 =0,IF(A1:A11<"",ROW(A1:A11)))))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the
SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"JP" wrote in message
...
I need to determine the maximum number of consecutive negative numbers
in a
column. The column contains formulas that evaluate to a positive
number,
a
negative number, zero or "" (blank). I cannot add an additional
column.
The
following are the results of formulas in cells A1:A11 that need a
formula
in
A12 that evaluates to 3, the maximum number of consecutive negative
numbers
counting cells A2, A6 and A7.

1
-2
""
""
""
-6
-7
8
-9
""
-11



.





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
Maximum negative number Tigerxxx Excel Discussion (Misc queries) 2 June 15th 09 06:35 PM
Find maximum row count of data Steve Excel Discussion (Misc queries) 4 August 20th 08 01:06 PM
how to count maximum number of lines repeated for a site Igneshwara reddy[_2_] Excel Worksheet Functions 4 March 19th 07 04:24 PM
Is there a maximum number of constraints... Omakbob Excel Worksheet Functions 3 March 1st 06 07:58 PM
getting the number of the row with the maximum value hilbert Excel Discussion (Misc queries) 3 April 5th 05 01:06 PM


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