LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 733
Default Count maximum consecutive positive numbers

"Tom Ogilvy" wrote...
the OP said:

This needs to be done using a single formula or array formula,
without using a separate running total column using =MAX, and
without using a UDF.

....
. . . however, this person said they were evaluating a "this
can't be done in a single formula" challenge.

Not sure why he posted in programming instead of the more logical
Worksheet.Functions


Indeed, so I'm crossposting to worksheet.functions. Follow-up there.

Of course it can be done in a single array formula - just barely.

If the data were in a single column by multiple row range named rec, then
try the following.

=COUNT(OFFSET(rec,MATCH(MAX(
MMULT(--(ROW(rec)=TRANSPOSE(ROW(rec)))
-(MMULT(--(ROW(rec)=TRANSPOSE(ROW(rec))),
--((rec<0)*ROW(rec)=TRANSPOSE(ROW(rec))))0),1-(rec<0))),
MMULT(--(ROW(rec)=TRANSPOSE(ROW(rec)))
-(MMULT(--(ROW(rec)=TRANSPOSE(ROW(rec))),
--((rec<0)*ROW(rec)=TRANSPOSE(ROW(rec))))0),1-(rec<0)),0)
-MAX(MMULT(--(ROW(rec)=TRANSPOSE(ROW(rec)))
-(MMULT(--(ROW(rec)=TRANSPOSE(ROW(rec))),
--((rec<0)*ROW(rec)=TRANSPOSE(ROW(rec))))0),1-(rec<0))),0,
MAX(MMULT(--(ROW(rec)=TRANSPOSE(ROW(rec)))
-(MMULT(--(ROW(rec)=TRANSPOSE(ROW(rec))),
--((rec<0)*ROW(rec)=TRANSPOSE(ROW(rec))))0),1-(rec<0))),1))




 
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
finding maximum, minimum in a range consists both Positive and Negative numbers Praveen Excel Worksheet Functions 3 May 4th 23 07:45 PM
count current run of positive numbers Morgan New Users to Excel 6 November 18th 09 02:09 AM
Count cells with positive numbers Jamie Excel Discussion (Misc queries) 5 October 24th 06 09:40 PM
how to add consecutive positive numbers shreen_farhad Excel Discussion (Misc queries) 1 October 2nd 05 07:51 PM
Count Consecutive Numbers in a Row Sam via OfficeKB.com Excel Worksheet Functions 5 February 19th 05 02:49 AM


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