Problem:

Columns B & C contain test dates and paper deadlines for each of the subjects listed in column A.
A test requires 3 days of preparation and a paper requires 5 days.
For each subject, we want to calculate the earliest date required to start preparing for either a test or a paper.

Solution:

Use the MIN and IF functions as shown in the following formula:
=MIN(IF(B2