The relative yields of mesons produced in pp and Pb-Pb collisions at sNN=5.02 TeV and reconstructed via the dimuon decay channel are measured using data collected by the CMS experiment. Double ratios are formed by comparing the yields of the excited states, (2S) and (3S), to the ground state, (1S), in both Pb-Pb and pp collisions at the same center-of-mass energy. The double ratios, [(nS)/(1S)]Pb-Pb/[(nS)/(1S)]pp, are measured to be 0.308±0.055(stat)±0.019(syst) for the (2S) and less than 0.26 at 95% confidence level for the (3S). No significant (3S) signal is found in the Pb-Pb data. The double ratios are studied as a function of collision centrality, as well as transverse momentum and rapidity. No significant dependencies are observed.