ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   lookup a value "greater than" 0 (https://www.excelbanter.com/excel-discussion-misc-queries/54586-lookup-value-greater-than-0-a.html)

Harold Good

lookup a value "greater than" 0
 
How would I do a lookup in a row with 4 values:
0 4.8 3.2 0
to find the first value that is greater than 0? The answer should be 4.8 but
what would the formula look like?

Thanks,

Harold



bpeltzer

lookup a value "greater than" 0
 
I hope someone can suggest something cleaner, but I think this will work...
If your values are in row 1:
=IF(A10,A1,INDEX(1:1,1+MATCH(0.0000000001,1:1,1)) )


"Harold Good" wrote:

How would I do a lookup in a row with 4 values:
0 4.8 3.2 0
to find the first value that is greater than 0? The answer should be 4.8 but
what would the formula look like?

Thanks,

Harold




Harold Good

lookup a value "greater than" 0
 
Thanks for your help bpelzter. Biff did suggest this one, both yours and his
work well.

Thanks for your help.

Harold
============
Try this:

Entered as an array using the key combo of CTRL,SHIFT,ENTER:

=INDEX(A4:D4,MATCH(TRUE,A4:D40,0))

A little more robust:

=INDEX(A4:D4,MATCH(1,(ISNUMBER(A4:D4))*(A4:D40),0 ))

Biff
=======================
"bpeltzer" wrote in message
...
I hope someone can suggest something cleaner, but I think this will work...
If your values are in row 1:
=IF(A10,A1,INDEX(1:1,1+MATCH(0.0000000001,1:1,1)) )


"Harold Good" wrote:

How would I do a lookup in a row with 4 values:
0 4.8 3.2 0
to find the first value that is greater than 0? The answer should be 4.8
but
what would the formula look like?

Thanks,

Harold







All times are GMT +1. The time now is 09:15 AM.

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