Gets really complicated really fast, indeed! Although even the formula there could be simplified (e.g., for Night-PIC-Cross-country, I'd use MIN(Night, PIC, Cross-country) and you need to be careful to do it on the individual flights, not the totals.
E.g., suppose you have three flights in...