Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Counting Zeros in a row until encounter first non-zero value

Is there a function, or combination of nested functions to count the number
of zeros in a row up until the first non-zero valued cell?

For Example

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30

For the First Row I want the function to return the value 6 and the second
row to return the value '7'

I do not want to know the total number of zeros in a row, I want to know the
number of zeros in a row until I encounter the first nonzero cell.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Counting Zeros in a row until encounter first non-zero value

Try
=MATCH(0.0001,1:1)
OR
=MATCH(0.0001,A1:J1)

If this post helps click Yes
---------------
Jacob Skaria


"Bubba" wrote:

Is there a function, or combination of nested functions to count the number
of zeros in a row up until the first non-zero valued cell?

For Example

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30

For the First Row I want the function to return the value 6 and the second
row to return the value '7'

I do not want to know the total number of zeros in a row, I want to know the
number of zeros in a row until I encounter the first nonzero cell.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default Counting Zeros in a row until encounter first non-zero value

Bubba wrote:
Is there a function, or combination of nested functions to count the number
of zeros in a row up until the first non-zero valued cell?

For Example

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30

For the First Row I want the function to return the value 6 and the second
row to return the value '7'

I do not want to know the total number of zeros in a row, I want to know the
number of zeros in a row until I encounter the first nonzero cell.



Try the following array formula (commit with CTRL+SHIFT+ENTER):

=MATCH(1,--(A1:K10),0)

That will return the result you specified, but not the answer to your original
question. Subtract one to answer that question.
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Counting Zeros in a row until encounter first non-zero value

Will there *always* be a non-zero entry to find? Are the non-zero numbers
*always* positive numbers greater than 0? Are there any TEXT entries in the
range? Are there any formula blanks in the range?

--
Biff
Microsoft Excel MVP


"Bubba" wrote in message
...
Is there a function, or combination of nested functions to count the
number
of zeros in a row up until the first non-zero valued cell?

For Example

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30

For the First Row I want the function to return the value 6 and the second
row to return the value '7'

I do not want to know the total number of zeros in a row, I want to know
the
number of zeros in a row until I encounter the first nonzero cell.



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Counting Zeros in a row until encounter first non-zero value

There will always be a non-zero number that is positive (greater than zero).
There are no text entries and no formula blanks.

I have tried:

=IF(J6=0,MATCH(0.0001,J6:BM6),0)

but the result is not always correct. Sometimes the formula counts
correctly, other times it returns a number equal to the range aka if data is
in columns J:BM it might sometimes returns '56' even though a nonzero number
was encountered before Column BM


"T. Valko" wrote:

Will there *always* be a non-zero entry to find? Are the non-zero numbers
*always* positive numbers greater than 0? Are there any TEXT entries in the
range? Are there any formula blanks in the range?

--
Biff
Microsoft Excel MVP


"Bubba" wrote in message
...
Is there a function, or combination of nested functions to count the
number
of zeros in a row up until the first non-zero valued cell?

For Example

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30

For the First Row I want the function to return the value 6 and the second
row to return the value '7'

I do not want to know the total number of zeros in a row, I want to know
the
number of zeros in a row until I encounter the first nonzero cell.






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Counting Zeros in a row until encounter first non-zero value

The ealier formula works only if the 1st cell starts with zero...If the 1st
cell do not have a zero then try the below

=MATCH(0.1,A6:J6)-MATCH(0,A6:J6,0)+1

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

Try
=MATCH(0.0001,1:1)
OR
=MATCH(0.0001,A1:J1)

If this post helps click Yes
---------------
Jacob Skaria


"Bubba" wrote:

Is there a function, or combination of nested functions to count the number
of zeros in a row up until the first non-zero valued cell?

For Example

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30

For the First Row I want the function to return the value 6 and the second
row to return the value '7'

I do not want to know the total number of zeros in a row, I want to know the
number of zeros in a row until I encounter the first nonzero cell.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Counting Zeros in a row until encounter first non-zero value

Ok, based on this:

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30
For the First Row I want the function to return the value
6 and the second row to return the value '7'


What you want to do is find the position of the first non-zero entry. In row
1 the first non-zero entry is located at position 6 and for row 2 the first
non-zero entry is located at position 7.

Try this:

=MATCH(TRUE,INDEX(J1:BM10,0),0)


--
Biff
Microsoft Excel MVP


"Bubba" wrote in message
...
There will always be a non-zero number that is positive (greater than
zero).
There are no text entries and no formula blanks.

I have tried:

=IF(J6=0,MATCH(0.0001,J6:BM6),0)

but the result is not always correct. Sometimes the formula counts
correctly, other times it returns a number equal to the range aka if data
is
in columns J:BM it might sometimes returns '56' even though a nonzero
number
was encountered before Column BM


"T. Valko" wrote:

Will there *always* be a non-zero entry to find? Are the non-zero numbers
*always* positive numbers greater than 0? Are there any TEXT entries in
the
range? Are there any formula blanks in the range?

--
Biff
Microsoft Excel MVP


"Bubba" wrote in message
...
Is there a function, or combination of nested functions to count the
number
of zeros in a row up until the first non-zero valued cell?

For Example

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30

For the First Row I want the function to return the value 6 and the
second
row to return the value '7'

I do not want to know the total number of zeros in a row, I want to
know
the
number of zeros in a row until I encounter the first nonzero cell.






  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Counting Zeros in a row until encounter first non-zero value

Perfect, thank you very much!

"T. Valko" wrote:

Ok, based on this:

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30
For the First Row I want the function to return the value
6 and the second row to return the value '7'


What you want to do is find the position of the first non-zero entry. In row
1 the first non-zero entry is located at position 6 and for row 2 the first
non-zero entry is located at position 7.

Try this:

=MATCH(TRUE,INDEX(J1:BM10,0),0)


--
Biff
Microsoft Excel MVP


"Bubba" wrote in message
...
There will always be a non-zero number that is positive (greater than
zero).
There are no text entries and no formula blanks.

I have tried:

=IF(J6=0,MATCH(0.0001,J6:BM6),0)

but the result is not always correct. Sometimes the formula counts
correctly, other times it returns a number equal to the range aka if data
is
in columns J:BM it might sometimes returns '56' even though a nonzero
number
was encountered before Column BM


"T. Valko" wrote:

Will there *always* be a non-zero entry to find? Are the non-zero numbers
*always* positive numbers greater than 0? Are there any TEXT entries in
the
range? Are there any formula blanks in the range?

--
Biff
Microsoft Excel MVP


"Bubba" wrote in message
...
Is there a function, or combination of nested functions to count the
number
of zeros in a row up until the first non-zero valued cell?

For Example

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30

For the First Row I want the function to return the value 6 and the
second
row to return the value '7'

I do not want to know the total number of zeros in a row, I want to
know
the
number of zeros in a row until I encounter the first nonzero cell.






  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Counting Zeros in a row until encounter first non-zero value

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Bubba" wrote in message
...
Perfect, thank you very much!

"T. Valko" wrote:

Ok, based on this:

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30
For the First Row I want the function to return the value
6 and the second row to return the value '7'


What you want to do is find the position of the first non-zero entry. In
row
1 the first non-zero entry is located at position 6 and for row 2 the
first
non-zero entry is located at position 7.

Try this:

=MATCH(TRUE,INDEX(J1:BM10,0),0)


--
Biff
Microsoft Excel MVP


"Bubba" wrote in message
...
There will always be a non-zero number that is positive (greater than
zero).
There are no text entries and no formula blanks.

I have tried:

=IF(J6=0,MATCH(0.0001,J6:BM6),0)

but the result is not always correct. Sometimes the formula counts
correctly, other times it returns a number equal to the range aka if
data
is
in columns J:BM it might sometimes returns '56' even though a nonzero
number
was encountered before Column BM


"T. Valko" wrote:

Will there *always* be a non-zero entry to find? Are the non-zero
numbers
*always* positive numbers greater than 0? Are there any TEXT entries
in
the
range? Are there any formula blanks in the range?

--
Biff
Microsoft Excel MVP


"Bubba" wrote in message
...
Is there a function, or combination of nested functions to count the
number
of zeros in a row up until the first non-zero valued cell?

For Example

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30

For the First Row I want the function to return the value 6 and the
second
row to return the value '7'

I do not want to know the total number of zeros in a row, I want to
know
the
number of zeros in a row until I encounter the first nonzero cell.








  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default Counting Zeros in a row until encounter first non-zero value

Hi,

Try this

=MATCH(TRUE,INDEX(E29:L290,,),0)-1

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Bubba" wrote in message
...
Is there a function, or combination of nested functions to count the
number
of zeros in a row up until the first non-zero valued cell?

For Example

0 0 0 0 0 35 0 50 60
0 0 0 0 0 0 40 10 0 0 30

For the First Row I want the function to return the value 6 and the second
row to return the value '7'

I do not want to know the total number of zeros in a row, I want to know
the
number of zeros in a row until I encounter the first nonzero cell.


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 savage a file that crashes? "Microsoft encounter a problem. GOH Excel Discussion (Misc queries) 4 September 17th 09 02:25 PM
Close Excel 2007 and encounter a problem Joe Excel Discussion (Misc queries) 3 September 8th 09 04:15 PM
Extract everything to the right in cell when a number is encounter Matt Excel Worksheet Functions 4 January 9th 08 03:25 PM
Error encounter when i try to click a hyperlink in Excel vic Excel Discussion (Misc queries) 0 December 13th 07 09:04 AM
Counting number of consecutive zeros at the end of a list [email protected] Excel Discussion (Misc queries) 2 September 22nd 05 12:47 PM


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