Finding minum positive from the result of formula

G

Guest

hi,

I have four five each contain number 5, 2, 3, 4, 6 in cell A1 to E1.
Now in a new cell let's say B1 i need to select the minum positive value
from below formula

formula 1 A1-B1 = 3
formula 1 A1-C1 = 2
formula 1 A1-D1 = 1
formula 1 A1-E1 = -1

How do i develop a formula to be able to show the value of (A1-D1) which is
the minimum positive value.
 
R

Rick Rothstein \(MVP - VB\)

I have four five each contain number 5, 2, 3, 4, 6 in cell A1 to E1.
Now in a new cell let's say B1 i need to select the minum positive value
from below formula

formula 1 A1-B1 = 3
formula 1 A1-C1 = 2
formula 1 A1-D1 = 1
formula 1 A1-E1 = -1

How do i develop a formula to be able to show the value of (A1-D1) which
is
the minimum positive value.

Probably not the most compact formula, but it does seem to do what you
asked...

=MIN(IF(A1-B1<=0,1E+300,A1-B1),IF(A1-C1<=0,1E+300,A1-C1),IF(A1-D1<=0,1E+300,A1-D1),IF(A1-E1<=0,1E+300,A1-E1))

Rick
 
G

Guest

=MIN(IF($A$1-$B1:$E1>0,$A$1-$B1:$E1))

Entered with Ctrl+Shift+Enter

You will get {} round the formula if entered correctly
 
H

Harlan Grove

haviv said:
I have four five each contain number 5, 2, 3, 4, 6 in cell A1 to E1.
Now in a new cell let's say B1 i need to select the minum positive value
from below formula

formula 1 A1-B1 = 3
formula 1 A1-C1 = 2
formula 1 A1-D1 = 1
formula 1 A1-E1 = -1

How do i develop a formula to be able to show the value of (A1-D1) which
is the minimum positive value.

=A1-MAX(B1:E1)
 
H

Harlan Grove

Harlan Grove said:
=A1-MAX(B1:E1)

Sorry, didn't read carefully enough. Either the regular formula

=A1-LARGE(B1:E1,COUNTIF(B1:E1,">="&A1))

or the array formula

=A1-MAX(IF(B1:E1<A1,B1:E1))
 
G

Guest

Did you test this ...

=A1-LARGE(B1:E1,COUNTIF(B1:E1,">="&A1))

????

Answer is -1 which not what OP wanted.

It also fails on this sequence of numbers:

5 2 3 4 4

or any sequence where B1 :E1 is not > A1
 
G

Guest

.. or to be correct

if B1:E1 < A1

Toppers said:
Did you test this ...

=A1-LARGE(B1:E1,COUNTIF(B1:E1,">="&A1))

????

Answer is -1 which not what OP wanted.

It also fails on this sequence of numbers:

5 2 3 4 4

or any sequence where B1 :E1 is not > A1
 
H

Harlan Grove

Toppers said:
Did you test this ...

=A1-LARGE(B1:E1,COUNTIF(B1:E1,">="&A1))

????
....

Nope. Off by one. It should be

=A1-LARGE(B1:E1,COUNTIF(A1:E1,">="&A1))
 

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