We extend our recently-developed heat-bath configuration interaction (HCI) algorithm, and our semistochastic algorithm for performing multireference perturbation theory, to the calculation of excited-state wavefunctions and energies. We employ time-reversal symmetry, which reduces the memory requirements by more than a factor of two. An extrapolation technique is introduced to reliably extrapolate HCI energies to the Full CI limit. The resulting algorithm is used to compute the twelve lowest-lying potential energy surfaces of the carbon dimer using the cc-pV5Z basis set, with an estimated error in energy of 30-50 {mu}Ha compared to Full CI. The excitation energies obtained using our algorithm have a mean absolute deviation of 0.02 eV compared to experimental values. We also calculate the complete active-space (CAS) energies of the S0, S1, and T0 states of tetracene, which are of relevance to singlet fission, by fully correlating active spaces as large as 18 electrons in 36 orbitals.