ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Finding minum positive from the result of formula (https://www.excelbanter.com/excel-discussion-misc-queries/150646-finding-minum-positive-result-formula.html)

haviv

Finding minum positive from the result of formula
 
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.

--
Sincerely Yours
Haviv

Rick Rothstein \(MVP - VB\)

Finding minum positive from the result of formula
 
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


Toppers

Finding minum positive from the result of formula
 
=MIN(IF($A$1-$B1:$E10,$A$1-$B1:$E1))

Entered with Ctrl+Shift+Enter

You will get {} round the formula if entered correctly
"haviv" wrote:

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.

--
Sincerely Yours
Haviv


Harlan Grove[_2_]

Finding minum positive from the result of formula
 
"haviv" wrote...
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)



Harlan Grove[_2_]

Finding minum positive from the result of formula
 
"Harlan Grove" wrote...
"haviv" wrote...

....
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)


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))



Toppers

Finding minum positive from the result of formula
 
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


"Harlan Grove" wrote:

"Harlan Grove" wrote...
"haviv" wrote...

....
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)


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))




Toppers

Finding minum positive from the result of formula
 
.. or to be correct

if B1:E1 < A1

"Toppers" wrote:

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


"Harlan Grove" wrote:

"Harlan Grove" wrote...
"haviv" wrote...

....
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)


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))




Harlan Grove[_2_]

Finding minum positive from the result of formula
 
"Toppers" wrote...
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))



haviv

Finding minum positive from the result of formula
 
Thanks,

Rick anwers is the most suitable one while sorry topper yours is not working

--
Sincerely Yours
Haviv


"Rick Rothstein (MVP - VB)" wrote:

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




All times are GMT +1. The time now is 08:02 AM.

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