View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme[_3_] Bernard Liengme[_3_] is offline
external usenet poster
 
Posts: 1,104
Default locate first value greater than

The UDF called with, fro example, =Tryme(B2:Q2) will return 3/16
best wishes

Function tryme(myrange)
mylast = myrange.Count
tryme = "No non-zero"
For Each mycell In myrange
If mycell.Value < 0 Then
tryme = mycell.Offset(-1, 0)
Exit For
End If
Next
End Function

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"MPI Planner" wrote in message
...
I would like to be able to return the first column that has a number
greater
than zero. For instance

3/2 3/9 3/16 3/23 3/30
Product A 0 0 12 0 20

How could I get a result that either returned 3/16 as the first date or
column 4 as the first instance?