Results 1 to 4 of 4
  1. #1
    3 Star Lounger djmoore's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    371
    Thanks
    21
    Thanked 1 Time in 1 Post

    IF formula won't work right (Excel 2000 SR1)

    I'm comparing Column C to Column A - column A has ALL valid values and I want to weed out the entries in Column C that are no valid, ie. do not occur in Column A. I am using this IF statement:

    =IF(C2=$A$2:$A$1217,"VALID","delete")

    but it only returns a TRUE value when the values in Col. C and Col. A appear in the same row.
    One value appears in C106 and A111, but since they are not on the same row the formula returns a FALSE value even though it is obviously in both columns.

    How can I change this so I get a TRUE response if the cell value in Col. C appears ANYWHERE in Col. A, not just in the same row?

    Many thanks -
    Have a cookie -

    Don

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: IF formula won't work right (Excel 2000 SR1)

    =IF(ISERROR(VLOOKUP(C2,$A$2:$A$1217,1,FALSE)),"del ete","VALID")
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: IF formula won't work right (Excel 2000 SR1)

    Hi,
    In addition to John's formula, you could also use:
    =OR(C2=$A$2:$A$1217)
    array-entered (i.e. press Ctrl-Shift-Enter)
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    The Hague, Netherlands
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IF formula won't work right (Excel 2000 SR1)

    =IF(COUNTIF($A$2:$A$1217,C2),"VALID","delete")

    should be a bit more efficient.
    Microsoft MVP - Excel

Posting Permissions

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