You need Solver.From Excel tool bar, choose Tools-Add Ins - Solver Add-in. It is a littlecomplicated to explain in email on how to set up the Solver. But your problem isa classic one. It should not be difficult to find examples on the internet.