• Comparison of 2 values (97 and up)

    Author
    Topic
    #372566

    Consider the following formula
    ColA…..ColB…..ColC
    1………….15………=A1>B1
    A…………..15……..=A2>B2

    C1 returns False, while C2 returns True. Does Excel automically convert the ’15’ to a string before the comparison? Is =N(A1)>N(B1) then the best formula to use for comparing 2 cells when one wants to ensure only numbers are compared?

    Thanks

    Viewing 0 reply threads
    Author
    Replies
    • #596016

      N(..) is not a good idea here, because if A1 contains a string and B1 a negative number, =N(A1)>N(B1) returns TRUE.

      You can use

      =IF(AND(ISNUMBER(A1),ISNUMBER(B1)),A1>B1,”Not numeric”)

    Viewing 0 reply threads
    Reply To: Comparison of 2 values (97 and up)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: