What is the value of $counter? Why have the ~min variable?
The counter is because in a loop i have to search for a number of vendors. The number varies from customer to customer.
The min is a dollar amount we won't charge under. that varies from customer to customer and is set by the vendor.
Have you confirmed that $Counter has the correct value?
Are the values in the other two variables lists of values separated by return characters?