# Excel Solver linear programming - Is it possible to use average of values as a constraint without #DIV/0! errors or sacrificing linearity?

I'm trying to create an assignment optimization model where the areas are assigned to either the south or north school districts so that the total distance is minimized. Each school must have at least 1500 students, an average income of at least \$85,000 and a minority % of at least 10%.

The issue I am having is that when I use solver to find a solution by changing cells G4:G13 (H4:H13 is calculated to be the opposite), there seems to be at least one iteration where the denominator of the average income of a school is 0 (in other words, no districts assigned to one school) and of course this causes a dividing-by-0 error. I tried adding a constraint to ensure each school had at least one district in it which did nothing to solve my problem and I also tried suppressing the error with =IFERROR() which only made the model non-linear.

I need to use the Simplex LP method in solver for this assignment. Is there a way I can add these "Average" constraints without issue?

Instead of $$\frac{\textrm{Total school income}}{\textrm{Number of areas}} \ge \ 85000$$ you could have a constraint $$\textrm{Total school income} \ge \ 85000 \times \textrm{Number of areas}.$$