ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Function to find the first cell that is not zero (https://www.excelbanter.com/excel-worksheet-functions/145871-function-find-first-cell-not-zero.html)

Mark[_3_]

Function to find the first cell that is not zero
 
Hi

I want to find the first cell that is not zero "0" across a row. I am also
trying a VBA solution, but is there perchance a function that will do this?

Mark





Gary''s Student

Function to find the first cell that is not zero
 
Function nonzero(r As Range) As String
nonzero = ""
For Each rr In r
If rr.Value < 0 Then
nonzero = rr.Address
Exit Function
End If
Next
End Function

so if in row 17, F17 contains the first non-zero value then:

=nonzero(17:17)

will return

$F$17
--
Gary''s Student - gsnu200727


"Mark" wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I am also
trying a VBA solution, but is there perchance a function that will do this?

Mark






T. Valko

Function to find the first cell that is not zero
 
You programmers always want to reinvent the wheel!

Biff

"Gary''s Student" wrote in message
...
Function nonzero(r As Range) As String
nonzero = ""
For Each rr In r
If rr.Value < 0 Then
nonzero = rr.Address
Exit Function
End If
Next
End Function

so if in row 17, F17 contains the first non-zero value then:

=nonzero(17:17)

will return

$F$17
--
Gary''s Student - gsnu200727


"Mark" wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I am
also
trying a VBA solution, but is there perchance a function that will do
this?

Mark








Gary''s Student

Function to find the first cell that is not zero
 
You are, of course, correct.

You have proved to me over and over in your posts that you can do things
with formulas that I though to be completely impossible without VBA. I have
actually bookmarked a Google Groups search of your material.
--
Gary''s Student - gsnu200728


"T. Valko" wrote:

You programmers always want to reinvent the wheel!

Biff

"Gary''s Student" wrote in message
...
Function nonzero(r As Range) As String
nonzero = ""
For Each rr In r
If rr.Value < 0 Then
nonzero = rr.Address
Exit Function
End If
Next
End Function

so if in row 17, F17 contains the first non-zero value then:

=nonzero(17:17)

will return

$F$17
--
Gary''s Student - gsnu200727


"Mark" wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I am
also
trying a VBA solution, but is there perchance a function that will do
this?

Mark









T. Valko

Function to find the first cell that is not zero
 
I have actually bookmarked a Google Groups
search of your material.


If I were you I'd change the "search for author" criteria to Harlan Grove.

Biff

"Gary''s Student" wrote in message
...
You are, of course, correct.

You have proved to me over and over in your posts that you can do things
with formulas that I though to be completely impossible without VBA. I
have
actually bookmarked a Google Groups search of your material.
--
Gary''s Student - gsnu200728


"T. Valko" wrote:

You programmers always want to reinvent the wheel!

Biff

"Gary''s Student" wrote in
message
...
Function nonzero(r As Range) As String
nonzero = ""
For Each rr In r
If rr.Value < 0 Then
nonzero = rr.Address
Exit Function
End If
Next
End Function

so if in row 17, F17 contains the first non-zero value then:

=nonzero(17:17)

will return

$F$17
--
Gary''s Student - gsnu200727


"Mark" wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I am
also
trying a VBA solution, but is there perchance a function that will do
this?

Mark











Peo Sjoblom

Function to find the first cell that is not zero
 
Domenic is a good search criteria as well, he is not as polite as Harlan
though :))


--
Regards,

Peo Sjoblom


"T. Valko" wrote in message
...
I have actually bookmarked a Google Groups
search of your material.


If I were you I'd change the "search for author" criteria to Harlan Grove.

Biff

"Gary''s Student" wrote in
message ...
You are, of course, correct.

You have proved to me over and over in your posts that you can do things
with formulas that I though to be completely impossible without VBA. I
have
actually bookmarked a Google Groups search of your material.
--
Gary''s Student - gsnu200728


"T. Valko" wrote:

You programmers always want to reinvent the wheel!

Biff

"Gary''s Student" wrote in
message
...
Function nonzero(r As Range) As String
nonzero = ""
For Each rr In r
If rr.Value < 0 Then
nonzero = rr.Address
Exit Function
End If
Next
End Function

so if in row 17, F17 contains the first non-zero value then:

=nonzero(17:17)

will return

$F$17
--
Gary''s Student - gsnu200727


"Mark" wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I am
also
trying a VBA solution, but is there perchance a function that will do
this?

Mark













T. Valko

Function to find the first cell that is not zero
 
LOL!

Biff

"Peo Sjoblom" wrote in message
...
Domenic is a good search criteria as well, he is not as polite as Harlan
though :))


--
Regards,

Peo Sjoblom


"T. Valko" wrote in message
...
I have actually bookmarked a Google Groups
search of your material.


If I were you I'd change the "search for author" criteria to Harlan
Grove.

Biff

"Gary''s Student" wrote in
message ...
You are, of course, correct.

You have proved to me over and over in your posts that you can do things
with formulas that I though to be completely impossible without VBA. I
have
actually bookmarked a Google Groups search of your material.
--
Gary''s Student - gsnu200728


"T. Valko" wrote:

You programmers always want to reinvent the wheel!

Biff

"Gary''s Student" wrote in
message
...
Function nonzero(r As Range) As String
nonzero = ""
For Each rr In r
If rr.Value < 0 Then
nonzero = rr.Address
Exit Function
End If
Next
End Function

so if in row 17, F17 contains the first non-zero value then:

=nonzero(17:17)

will return

$F$17
--
Gary''s Student - gsnu200727


"Mark" wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I
am
also
trying a VBA solution, but is there perchance a function that will
do
this?

Mark















Mark[_3_]

Function to find the first cell that is not zero
 
Many thanks. I'll try it after I get home agian.

Cheers


"Gary''s Student" wrote in message
...
Function nonzero(r As Range) As String
nonzero = ""
For Each rr In r
If rr.Value < 0 Then
nonzero = rr.Address
Exit Function
End If
Next
End Function

so if in row 17, F17 contains the first non-zero value then:

=nonzero(17:17)

will return

$F$17
--
Gary''s Student - gsnu200727


"Mark" wrote:

Hi

I want to find the first cell that is not zero "0" across a row. I am
also
trying a VBA solution, but is there perchance a function that will do
this?

Mark









All times are GMT +1. The time now is 07:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com