Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max and Min Difference Formula

Status
Not open for further replies.

michael168

Vendor
Oct 8, 2003
3
MY
Can someone show the formula for max and min difference?

Cells
A1=5
B1=3
C1=4
D1=8
E1=1

In G1 for min difference of sum = C1-B1 = 1
In H1 for max difference of sum= D1-E1 = 7
How to do this in the range (A1:E1)? Cells value in the are changing constantly.
Thank you.
 
=SUM(LARGE(A1:E1,{1,2}))
What about the above answer?
What I need to is how to code.
Thanks
 
The "Max" is relaticely simople:

Max('range' - Min('range')

The "Min" requires a search which depending on the actual range could be tedious. I would think:

create an array

import all of the values in range

sort them

Set a Variable (myNin?) to some large value (max for the data type)

loop through to compare the currnt to the next

Set the variable (MyMin) to it if it is less than the 'current' value of the variable (MyMin)




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
michael168

Your formula ADDS the 2 largest values.

That's NOT what your originally asked for.

"max difference of sum" empahsis added

Actually, the max difference one is the easiest -- a schoolboy could figger that one out!

Ya gotta work consistent, here, mike!

Skip,
Skip@TheOfficeExperts.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top