Formula help!!!

  • Thread starter Thread starter japc90
  • Start date Start date
J

japc90

I am trying to write a formula that will look in one cell and if it
finds a value greater than zero it pulls that number in. If the cell
is blank or the value is zero it will move to the next cell. If that
cell value is greater than zero it will pull it in if blank or equal
to zero it will go to the next cell.

Any help is appreciated.
 
With
A1:A3 containing either positive numbers or blanks

Try something like this:
=INDEX(A1:A3,SUMPRODUCT(MATCH(1,--(A1:A3>0),1)))

If none of the cells contains a positive value, the formula returns zero.

Does that help?
***********
Regards,
Ron

XL2002, WinXP
 
Doesn't it just figure.....I click the [Post] button *then* I see the flaw in
the formula.

Try this, instead:
=IF(COUNTIF(A1:A3,">0"),INDEX(A1:A3,SUMPRODUCT(MATCH(1,--(A1:A3>0),0))),0)

***********
Regards,
Ron

XL2002, WinXP
 
While the 2nd formula I posted works.....
try this much less fancy one:
=IF(A1>0,A1,IF(A2>0,A2,IF(A3>0,A3,0)))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


Ron Coderre said:
Doesn't it just figure.....I click the [Post] button *then* I see the flaw in
the formula.

Try this, instead:
=IF(COUNTIF(A1:A3,">0"),INDEX(A1:A3,SUMPRODUCT(MATCH(1,--(A1:A3>0),0))),0)

***********
Regards,
Ron

XL2002, WinXP


Ron Coderre said:
With
A1:A3 containing either positive numbers or blanks

Try something like this:
=INDEX(A1:A3,SUMPRODUCT(MATCH(1,--(A1:A3>0),1)))

If none of the cells contains a positive value, the formula returns zero.

Does that help?
***********
Regards,
Ron

XL2002, WinXP
 
While the 2nd formula I posted works.....
try this much less fancy one:
=IF(A1>0,A1,IF(A2>0,A2,IF(A3>0,A3,0)))

Does that help?
***********
Regards,
Ron

XL2002, WinXP



Ron Coderre said:
Doesn't it just figure.....I click the [Post] button *then* I see the flaw in
the formula.
Try this, instead:
=IF(COUNTIF(A1:A3,">0"),INDEX(A1:A3,SUMPRODUCT(MATCH(1,--(A1:A3>0),0))),0)

XL2002, WinXP
"Ron Coderre" wrote:

- Show quoted text -

PERFECT! Thank you
 

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

Similar Threads


Back
Top