You are asking whether the photon has to have exactly the same energy as the difference between two energy levels (bang gap), to be absorbed by the electron/atom system. The answer is no, first of all, it is QM, and all probabilities, but more importantly, if the photon has excess energy (exceeding the band gap), the electron might still be excited, and the excess energy will be transformed into the kinetic energy of the electron inside the new band.
No, it is sufficient for the photon energy to exceed the band gap. Any excess energy is transformed into kinetic energy for the electron in the new band.
Is the Energy of an absorbed photon exactly the energy of the band gap?
Now you are correct, that if the photon energy does not meet the minimal required energy to excite the electron, then the electron should not be excited (with a high probability).
It is very important to understand that because of the quantum mechanical (probabilistic) nature of the world, we do not need to talk about exact matches between the band gap and the photon energy, first of all, even if the two would exactly match, even then there is only certain probability that the electron will be or will not be excited. Second, and most importantly, it is not correct (in your case) to talk about specific photon energy levels, since photon energy levels are never exactly defined.
You should also take into account that photon energies are never exactly defined except for monochromatic beams with infinite temporal duration. This is exactly because of the energy-time uncertainty relation: the only way to have a perfectly defined photon frequency, and hence energy, is to observe it for an infinitely long time. Thus, the photon energy is always spread out over a finite bandwidth.