This work presents a substantial improvement of the variables’ inclusion and interchange algorithm (VIIA) for capacitors placement that considers circuits with harmonic distortion. Several load states are considered, and fixed and switched capacitors are employed in optimization. All the pertinent constraints of voltage magnitude, total harmonic distortion, individual harmonic distortion, and of overstress of capacitors are implemented. The here defined global harmonic-distortion index states the distance to the feasibility or the unfeasibility of a solution with respect the harmonic distortion constraints. The inclusion in the sequential quadratic programming sub-problem of an inequality linear constraint on this global harmonic-distortion index, allows the determining of solutions that comply with the harmonic distortion related constraints. A comparison of the solutions of various examples obtained by the presented method with the best solutions obtained by the Matlab’s genetic algorithm shows the effectiveness of this method.