To calculate the electric flux through a box with varying electric fields, one must consider the contributions from each of the six faces. The flux through the top face is calculated as -36, while the bottom face contributes +36 due to the direction of the normal vector. For the right side, the flux is determined to be 162, based on the electric field's dependence on the variable y. The left side yields zero flux since the electric field is not present there. Understanding the orientation of the normal vectors and the electric field values is crucial for accurate calculations.