select the cell you want to conditionally format, then on the home tab, click on "conditional formatting," then on "manage rules."
Now click on "New rule," then on "use a formula to determine which cells to format"
Add your condition that should be applied last. So something like "=cell below= y". Whatever your formulas are, they need to evaluate to TRUE or FALSE.
Then select the formatting you want applied, hit ok.
Then do the exact same thing for "cell above," i.e. hit "New rule,", then "use a formula..."
Your "format C" is your default in the equation you gave as the example, so you shouldn't need to enter a formula for that, just set that as the format for the cell.
You might have some logic issues you'll have to resolve. What if, in your formula,
"IF(cell above = x, format a, IF(cell below=y,format b,format c))"
both cell above is x AND cell below = y?
You can move the order the rules get applied with the two arrows to the right of "delete rule." Also, don't forget you can use the And() and Or() functions in each/both of the rules if that will make the logic work to format the cells as you need. Just make sure that whatever you put in each rule as a formula, it can only evaluate to TRUE or FALSE.