Find first value in a range

J

JonoB

Hi,
I have a range called UnitPhase that is one column of data. I need
formula that will return the first cell that is greater than zero.

I have tried some array formulas but cant get it to work, such a
{=INDEX(UnitPhase,MIN((UnitPhase<>"0")*ROW(UnitPhase)))}

I bviously dont have the correct syntax, so any help is muc
appreciated
 
F

Frank Kabel

Hi
the following array formula will work if you have only values in your
range
=INDEX(UnitPhase,MIN(IF(UnitPhase>0,ROW(UnitPhase))))
 
P

Peo Sjoblom

One way,

=INDEX(UnitPhase,MATCH(TRUE,UnitPhase>0,0))

entered with ctrl + shift & enter
 
J

JonoB

Thanks guys, both

=INDEX(UnitPhase,MIN(IF(UnitPhase>0,ROW(UnitPhase))))

and

=INDEX(UnitPhase,MATCH(TRUE,UnitPhase>0,0))

work 100%.

If I wanted to return the actual cell reference, I could do a lookup on
the above result, but I suspect that this could actually be achieved in
the array formula.

Once again, thanks for the help.
 
F

Frank Kabel

Hi
if you only want the row number use either the array formula
=MIN(IF(UnitPhase>0,ROW(UnitPhase)))

or
MATCH(TRUE,UnitPhase>0,0)
 
P

Peo Sjoblom

To get the cell reference

=CELL("address",INDEX(UnitPhase,MATCH(TRUE,UnitPhase>0,0)))

note that match formula should be faster than (min * row)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top