I am not sure how to accurately convey this idea. I am not even sure if excel is capable of providing the solution I am looking for.

Setting: School
Staff: 100 teachers
Each with their own timetable/schedule/teaching periods.

If a teacher is not present, relief planning is needed.
Is there a way that excel can calculate which teachers are free to fill in the relief slots.
Similarly, if 10 teachers are not present for the day can excel automate the search for a relief.

Thank you