Current location - Training Enrollment Network - Mathematics courses - Excel vba minimum value
Excel vba minimum value
According to the requirements of the topic, b1> =A 1,B2 & gt; =A2,B3 & gt; =A3, B4 & gt=A4, minimum sum (b 1:B4)- and (A 1: A4) are required.

And A 1:A4 is constant, that is, SUM(B 1:B4) is required to be the minimum.

As can be seen from the first condition, one of A and B must be the maximum value in A 1:A4, assuming that B is the maximum value here.

B=MAX(A 1, A2, A3, A4), and the value of b is stored in D2.

To find A again, SUM(B 1:B4) has four possible results regardless of the order of A 1: A4.

A=min(A 1:A4), then sum (b1:B4) = a+3b = min (a1:a4)+3b.

A = small (a1:a4,2), then sum (b 1: B4) = 2a+2b = small (a1:a4,2 2) * 2+2b.

A = small (a1:a4,3), then sum (b 1: B4) = 3a+b = small (a1:a4,3) * 3+b.

With the same size, a=b, then SUM(B 1:B4)=4b, which can be ignored here.

So as long as we find the minimum value of the above three items, we can get the value of a (in addition, we can remove a B. )

If the value is stored in D 1, the formula of D 1 is:

= IF(MIN(a 1:A4)+2 * D2 & lt; SMALL(A 1:A4,2)*2+D2,IF(MIN(a 1:A4)+2 * D2 & lt; SMALL(A 1:A4,3)*3,MIN(A 1:A4),SMALL(A 1:A4,3)),IF(SMALL(A 1:A4,2)* 2+D2 & lt; Small (a1:a4,3) * 3, small (a1:a4,2), small (a1:a4,3))