The production of (1S), (2S), and (3S) is investigated in pPb and pp collisions at centre-of-mass energies per nucleon pair of 5.02 TeV and 2.76 TeV, respectively. The datasets correspond to integrated luminosities of about 31 nb(-1) (pPb) and 5.4 pb(-1) (pp), collected in 2013 by the CMS experiment at the LHC. Upsilons that decay into muons are reconstructed within the rapidity interval |y (CM)| < 1.93 in the nucleon-nucleon centre-of-mass frame. Their production is studied as a function of two measures of event activity, namely the charged-particle multiplicity measured in the pseudorapidity interval |eta| < 2.4, and the sum of transverse energy deposited at forward pseudorapidity, 4.0 < |eta| < 5.2. The cross sections normalized by their event activity integrated values, (nS)/aEuro(nS)aEuro parts per thousand, are found to rise with both measures of the event activity in pp and pPb. In both collision systems, the ratios of the excited to the ground state cross sections, (nS)/ (1S), are found to decrease with the charged-particle multiplicity, while as a function of the transverse energy the variation is less pronounced. The event activity integrated double ratios, [(nS)/ (1S)](pPb) /[(nS)/ (1S)](pp), are also measured and found to be 0.83 +/- 0.05 (stat.) +/- 0.05 (syst.) and 0.71 +/- 0.08 (stat.) +/- 0.09 (syst.) for (2S) and (3S), respectively.