PDA

View Full Version : Excel vba code to iterate through list and match to total



Neald
07-23-2018, 09:51 AM
I have a list of values 6-144. I need code to iterate through each row of the list and match the values as close as possible to 144. Imagine a 144in piece of wire or wood and we have a list of lengths we need. I need to be able to match the lengths up to make lengths as close to 144, wasting as little as possible. Any help would be greatly appreciated.

NoSparks
07-23-2018, 03:28 PM
What's the kerf ?
What's a typical list ?

Neald
07-27-2018, 03:06 PM
Not sure what you mean kerf...
But an exaple would be 1 per row

144
144
138
132
124
120
110
72
72
72
36
36
36
42
18
18
12
6
6
6
6

So they should be matched up in sets that total 144 or as close as possible for the least waste. I currently have it making solutions but idk how to get it to evaluate best solutions