Electromagnetic simulations of complex geologic settings are computationally expensive. One reason for this is the fact that a fine mesh is required to accurately discretize the electrical conductivity model of a given setting. This conductivity model may vary over several orders of magnitude and these variations can occur over a large range of length scales. Using a very fine mesh for the discretization of this setting leads to the necessity to solve a large system of equations that is often difficult to deal with. To keep the simulations computationally tractable, coarse meshes are often employed for the discretization of the model. Such coarse meshes typically fail to capture the fine-scale variations in the conductivity model resulting in inaccuracies in the predicted data. In this work, we introduce a framework for constructing a coarse-mesh or upscaled conductivity model based on a prescribed fine-mesh model. Rather than using analytical expressions, we opt to pose upscaling as a parameter estimation problem. By solving an optimization problem, we obtain a coarse-mesh conductivity model. The optimization criterion can be tailored to the survey setting in order to produce coarse models that accurately reproduce the predicted data generated on the fine mesh. This allows us to upscale arbitrary conductivity structures, as well as to better understand the meaning of the upscaled quantity. We use 1D and 3D examples to demonstrate that the proposed framework is able to emulate the behavior of the heterogeneity in the fine-mesh conductivity model, and to produce an accurate description of the desired predicted data obtained by using a coarse mesh in the simulation process.