Electronically excited states play important roles in many chemical reactions and spectroscopic techniques. In quantum chemistry, a common technique to solve excited states is the multiroot Davidson algorithm, but it is not designed for processes like X‐ray spectroscopy that involves hundreds of highly excited states. We show how the use of a restricted active space wavefunction together with a projection operator to remove low‐lying electronic states offers an efficient way to reach single and double‐core‐hole states. Additionally, several improvements to the stability and efficiency of the configuration interaction (CI) algorithm for a large number of states are suggested. When applied to a series of transition metal complexes the new CI algorithm does not only resolve divergence issues but also leads to typical reduction in computational time by 70%, with the largest savings for small molecules and large active spaces. Together, the projection operator and the improved CI algorithm now make it possible to simulate a wide range of single‐ and two‐photon spectroscopies. © 2019 Wiley Periodicals, Inc.