Nested IF Limits
On 18 May, 14:56, ronnomad wrote:
=IF(K37<0,IF(L37=K37*-1,COUNT(L37),IF((L37+M37)=K37*-1,COUNT(L37:M37),IF(SUM(L37:N37)=K37*-1,COUNT(L37:N37),IF(SUM(L37:O37)=K37*-1,COUNT(L37:O37),IF(SUM(L37:P37)=K37*-1,COUNT(L37:P37),COUNT(L37:AC37)))))),0)
I can ship a limit of 24 containers at a time but, if a particular material
requires more than 7 containers, this formula shows the total number of
continers rather than the number needed.
Here's a non-nested alternative:
=MIN(IF(L37K37*-1,1,999),IF(SUM(L37:M37)K37*-1,2,999),IF(SUM(L37:N37)K37*-1,3,999),IF(SUM(L37:O37)K37*-1,4,999),IF(SUM(L37:P37)K37*-1,5,999),IF(SUM(L37:Q37)K37*-1,6,),........)
The MIN will find the lowest value in the sequence (ie the first time
there is enough units). If this resolves to 999, then you don't have
enough units even taking all 24 containers.
Caveat: If you don't put a negative value in K37, results will be
unexpected.
HTH
Andrew
|