Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Retun greatest # of cells between nonzero

OK, I think I've seen this before, but I can't recall how it's done. So, if I
have a table with dates as headers, and a particular row may have, say:


0 0 0 1 0 0 0 0 0 0 2 0 0 1 0 0 0 4 0 0 0 0 0 1

As individual values.


I would like a formula that tells me that the longest time frame between
non-zero fields was 6 days. The actual value of the nonzero cells can vary.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Retun greatest # of cells between nonzero

Lets say your data is in row #1. In A2 enter:
=IF(A1=0,1,0)

In B2 enter:
=IF(B1=0,A2+1,0) and copy across.

We see:
0 0 0 1 0 0 0 0 0 0 2 0 0 1 0 0 0 4 0 0 0 0 0 1
1 2 3 0 1 2 3 4 5 6 0 1 2 0 1 2 3 0 1 2 3 4 5 0

Now all we need is:
=MAX(2:2)

--
Gary''s Student - gsnu200772


"Sean Timmons" wrote:

OK, I think I've seen this before, but I can't recall how it's done. So, if I
have a table with dates as headers, and a particular row may have, say:


0 0 0 1 0 0 0 0 0 0 2 0 0 1 0 0 0 4 0 0 0 0 0 1

As individual values.


I would like a formula that tells me that the longest time frame between
non-zero fields was 6 days. The actual value of the nonzero cells can vary.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Retun greatest # of cells between nonzero

That's waht I was looking for! Thank you!

"Gary''s Student" wrote:

Lets say your data is in row #1. In A2 enter:
=IF(A1=0,1,0)

In B2 enter:
=IF(B1=0,A2+1,0) and copy across.

We see:
0 0 0 1 0 0 0 0 0 0 2 0 0 1 0 0 0 4 0 0 0 0 0 1
1 2 3 0 1 2 3 4 5 6 0 1 2 0 1 2 3 0 1 2 3 4 5 0

Now all we need is:
=MAX(2:2)

--
Gary''s Student - gsnu200772


"Sean Timmons" wrote:

OK, I think I've seen this before, but I can't recall how it's done. So, if I
have a table with dates as headers, and a particular row may have, say:


0 0 0 1 0 0 0 0 0 0 2 0 0 1 0 0 0 4 0 0 0 0 0 1

As individual values.


I would like a formula that tells me that the longest time frame between
non-zero fields was 6 days. The actual value of the nonzero cells can vary.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Retun greatest # of cells between nonzero

Try this array formula** :

=MAX(FREQUENCY(IF(A2:X2=0,COLUMN(A2:X2)),IF(A2:X2< 0,COLUMN(A2:X2))))

Note that empty cells will be evaluated as 0.

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)


--
Biff
Microsoft Excel MVP


"Sean Timmons" wrote in message
...
OK, I think I've seen this before, but I can't recall how it's done. So,
if I
have a table with dates as headers, and a particular row may have, say:


0 0 0 1 0 0 0 0 0 0 2 0 0 1 0 0 0 4 0 0 0 0 0 1

As individual values.


I would like a formula that tells me that the longest time frame between
non-zero fields was 6 days. The actual value of the nonzero cells can
vary.



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
How to find the first nonzero cell in a row Katie Excel Worksheet Functions 9 September 12th 08 03:58 AM
Counting NONZERO Cells - Filtered and Pivoted RJB Excel Discussion (Misc queries) 6 December 15th 07 12:29 AM
How do I create a formula to retun a value of 0 (zero) when a VLO. Adam at GTOFL Excel Worksheet Functions 4 February 20th 05 06:15 AM
find first nonzero value in column DAVID Excel Worksheet Functions 5 January 11th 05 03:31 AM
nonzero value DAVID Excel Worksheet Functions 2 January 10th 05 05:07 PM


All times are GMT +1. The time now is 11:56 PM.

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"