Thank you NBVC for the solution (partial), but I think I didn't make things clear. By the way, I also understood Aladin's solution.
Here is what I meant:
If A1=+5 and B=+9 then C1=+9 (Maxima)
If A1=-5 and B=-9 then C1=-9 (Minima)
If A1=-9 and B=+2 then C1=-9/+2 (both maxima and minima)
It is also a requirement that if anyone of A1 or B1 is 0 then it should only show the maxima or minima with its sign.