Mar 22 2021 12:51 PM
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?
Mar 22 2021 01:09 PM
Mar 22 2021 05:01 PM
SolutionRe: ``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.
Mar 22 2021 07:35 PM
Mar 22 2021 07:37 PM
Mar 22 2021 05:01 PM
SolutionRe: ``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.