Not sure I understand you but here's my best guess...

=LOOKUP(2,1/(B10:B1000<>0),A10:A1000)