SOLVED

Excel 2000 formulas

Brass Contributor

I'm trying to improve my Excel skills. Excel formulas: I can't understand why my logic is wrong. This what I'm trying to do. Formula to be placed in cell Y12. If the number in cell X12 is 8 or less, enter the value of X12. If it is greater than 8 enter 8. My formula: =IF((OR(X12=<8,X12>8)),8,0).

2 Replies
best response confirmed by marty007 (Brass Contributor)
Solution
OR returns true if one or more of it's arguments are true. Since you are testing for X12<=8 OR X12>8, at least one of those conditions will always be true (X12 will always be <=8 OR >8). So, your IF function will always return the true argument, which is 8.

IF(X12 is less than/equal to 8, then return X12, else return 8).
=IF(X12<=8, X12, 8)

Another option:
=MIN(X12, 8)

Thanks very much. Very helpful

1 best response

Accepted Solutions
best response confirmed by marty007 (Brass Contributor)
Solution
OR returns true if one or more of it's arguments are true. Since you are testing for X12<=8 OR X12>8, at least one of those conditions will always be true (X12 will always be <=8 OR >8). So, your IF function will always return the true argument, which is 8.

IF(X12 is less than/equal to 8, then return X12, else return 8).
=IF(X12<=8, X12, 8)

Another option:
=MIN(X12, 8)

View solution in original post