Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Western NY, USA
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Comparison of 2 values (97 and up)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Comparison of 2 values (97 and up)

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •