Forum Discussion

marty007's avatar
marty007
Brass Contributor
Mar 19, 2021
Solved

Excel 2000 formulas

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).

  • 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, 😎

    Another option:
    =MIN(X12, 😎

2 Replies

  • JMB17's avatar
    JMB17
    Bronze Contributor
    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, 😎

    Another option:
    =MIN(X12, 😎

Resources