Hi

I have no idea how to achieve my aim at the moment. Pointing it in the right direction might help.
What I want to do is use Excel to work out the number of lengths of wood I require for a given number of pieces.
EG (examples are in millimeters)If I have pieces of 2232, 549, 1700, 450, 908, 325 and the available lengths of timber are 2400, I want to test by

addition the pieces which are as close as possible to 2400, place a count for the first set, then count the next lot of numbers etc.
From my example I would expect to receive the answer 3.
546+450+908+325=2142=1
1700<2400=1
2232<2400=1
1+1+1=3

I have been thinking about this for some time, have tried If and Sum in great long turgid equations like =IF($D$2>SUM(A3:A4),SUM(A3:A5),IF(SUM(A3:A5<

$D$2),SUM(A3:A6),IF(SUM(A3:A6<$D$2),SUM(A3:A7)))) This works as far as it goes but it does not mark an cell as counted so using it in the next cell is

pointless as it returns the same answer because it just counts the same stuff again.
maybe this is better done in VB?