We first observe that for Lifshitz black holes whose only charge is the mass, the resulting Smarr relation is a direct consequence of the Lifshitz Cardy formula. From this observation, we propose to extend the Cardy formula to the case of electrically charged Lifshitz black holes satisfying as well a Smarr relation. The expression of our formula depends on the dynamical exponent, the energy and the charge of the ground state which is played by a magnetically charged soliton obtained through a double Wick rotation. The expression also involves a factor multiplying the chemical potentials which varies in function of the electromagnetic theory considered. This factor is precisely the one that appears in the Smarr formula for charged Lifshitz black holes. We test the validity of this Cardy formula in different situations where electrically Lifshitz charged black holes satisfying a Smarr relation are known. We then extend these results to electrically charged black holes with hyperscaling violation. Finally, an example in the charged AdS case is also provided.