View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Find the fewest values to equal a set total

Here's another one...

A1 = total thickness needed = 235

C1:G1 = 10, 8, 5, 3, 1

Enter this formula in C2:

=IF(A1<C1,0,INT(A1/C1))

Enter this formula in D2 and copy across to G2:

=IF(D1$A1-SUMPRODUCT($C1:C1,$C2:C2),0,INT(($A1-SUMPRODUCT($C1:C1,$C2:C2))/D1))

--
Biff
Microsoft Excel MVP


"Chris" wrote in message
...
I have 5 parts with a thickness of 1, 3, 5, 8, and 10. I need to figure out
the fewest parts that will equal a total thickness of any given number. If
I
need a total thickness of 235, what's the smallest combination of 10s, 8s,
5s, 3s, and 1s that will get me to this total? (23 tens, and 1 five). I
need
to plug in any number for the total thickness and figure out the fewest
possible parts to get me there (and the quantities of each). Can this be
done
in Excel and how?