Problem:

Row 2 lists amounts payable over a twelve month period.
A blank cell in the row indicates that no payment is due that month.
We want to create a new row that, for each month, will display the name of the month in which the next payment is due.

Solution:

Use the INDEX, MATCH, MIN, IF, and COLUMN functions as shown in the following Array formula:
{=INDEX(C1:M1,MATCH(MIN(IF(C2:M2
Enter the formula in cell B3 and copy/paste it across the row from cell B3 up to cell M3.