+ Reply to Thread
Results 1 to 5 of 5

Help needed with IF statement

  1. #1
    Registered User
    Join Date
    08-07-2012
    Location
    Alexandria, VA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Help needed with IF statement

    I have a column of unique text names in column D. I also have a column of names in column G (that are unique in column G but may also show in column D). In column H, I'd like to create a function that searches column D and compares the names in column G -- returning a '2' if it shows in D and a 1 if it does not.

    I've tried a few If statements but I'm assuming it's not working because the columns do not equal the text, it contains the text....

    Please help...

    Thanks!

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Help needed with IF statement

    Try this

    =2-ISNA(MATCH(G1,D$1:D$100,0))

    or this

    =IF(ISNA(MATCH(G1,D$1:D$100,0)),1,2)

    and copy down the column
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Help needed with IF statement

    Assuming data starts in row 2
    In H2,
    =IF(ISNUMBER(MATCH(G2,$D$2:$D$10000,0)),1,2)
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    08-07-2012
    Location
    Alexandria, VA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Help needed with IF statement

    Fantastic!!!! Thank you so much.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Help needed with IF statement

    @ jnall1. Welcome to the forum.

    If you are satisfied with the solution(s) provided, please remember to mark your thread as Solved.

    New quick method:
    Select Thread Tools (above first post on page) -> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word "Title" you will see a dropdown with the words "No prefix".
    Change to "Solved"
    Click Save

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1