SOLVED

Contributor

# Excel formulas

What I'm trying to do:

Cell A1 has a numeric value. In cell B1, I want to be able to do the following:

If A1 is =<12, enter the value in cell A1 into cell B1

If A1 is greater than 12, enter 12 into cell B1

My formula is:

=IF((OR(E9<=12, E9>12)), E9,12)

What is wrong with my logic?

4 Replies

# Re: Excel formulas

=IF(A1<=12,A1,12)

Thanks

Tauqeer

best response confirmed by marty007 (Contributor)
Solution

# Re: Excel formulas

Re: ``If A1 is =<12, enter the value in cell A1 into cell B1. If A1 is greater than 12, enter 12 into cell B1``

=MIN(12, A1)

-----

Re: ``=IF((OR(E9<=12, E9>12)), E9,12). What is wrong with my logic?``

E9 is always "<=12" (less than or equal to) or ">12" (greater than).  So the condition is always TRUE, and E9 is always returned.

I suspect you intended to write IF(OR(E9=12,E9<12), E9, 12)

But that is the same as IF(E9<=12, E9, 12), which is better -- but not better than the MIN expression above.

# Re: Excel formulas

Your formula worked, thanks. Someone else sent me this formula: =MIN(12, A1). I don't understand it as well as yours but it seems simpler.

# Re: Excel formulas

IF(E9<=12, E9, 12) seems easier for me to grasp but =MIN(12, A1) is clearly simpler. I'm learning!
Thanks very much.