# Excel if/then formula

Posted on

QUESTION :

I am wondering if there is an if/then formula for the following situation. I am trying to populate a monthly calendar. I want the calendar to show the value in `A1` if the value in `B1:B100` is equal to a specific date.

``````  A                  B
1 Fees Due           15-Mar
2 Registration Open  01-Apr
``````

So if the formula is entered into the March 15th cell, it would result in “Fees Due”. But on April 1st, it would show “Registration Open”.

Any chance this is possible?

I think what you want is a formula that uses `INDEX` and `MATCH`. For instance, if the date you are looking up is in `D2`, you would use the following:

``````=INDEX(\$A\$1:\$A\$100,MATCH(D2,\$B\$1:\$B\$100,0))
`````` Alternatively, you can use an IF statement.
Let’s say your calendar dates start in cell D1 (next date is D2, and so on).
In cell E1 put the formula `=IF(D1=\$B\$1,\$A\$1,\$A\$2)`
You can then drag the formula down in column E

The formula references the values you put in cells A1, A2, B1 & B2, as per your original post