+ Reply to Thread
Results 1 to 8 of 8

Search two columns and if value is shown in another column then return Yes/No

  1. #1
    Registered User
    Join Date
    08-13-2009
    Location
    Glasgow
    MS-Off Ver
    Excel 2016,2016,365
    Posts
    85

    Search two columns and if value is shown in another column then return Yes/No

    Hello

    Can't seem to get this correct.

    I have two columns A ( staffid) B (old staff id)

    and in another column C I have a mix of staff ID's

    I want to search this mix and look in Column A and Column B if is exists return "yes" and if not then "no"

    Its over the two columns part I seem to be struggling with.

    Thanks
    Ross

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs
    MS-Off Ver
    MS Office 365
    Posts
    20,501

    Re: Search two columns and if value is shown in another column then return Yes/No

    Please read the yellow banner at the top of this page on how to attach a file.

  3. #3
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,502

    Re: Search two columns and if value is shown in another column then return Yes/No

    Here's my best guess from the provided info:

    rosscortb.png

    The formula in D2 copied down as far as necessary is:
    =IF(AND(ISERROR(MATCH(C2, A2:A100, 0)), ISERROR(MATCH(C2, B2:B100, 0))), "no", "yes")

    If this is not what you are looking for then please follow Alan's request in post #2
    Geoff

    Did I help significantly? If you wish, click on * Add Reputation to say thanks.
    If your problem has been resolved please select “Solved” from the Thread Tools menu

  4. #4
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    1,423

    Re: Search two columns and if value is shown in another column then return Yes/No

    Another option:

    =IF(COUNTIFS($A$2:$b$100,C2)>0,"yes","no")
    (and copy it down

  5. #5
    Registered User
    Join Date
    08-13-2009
    Location
    Glasgow
    MS-Off Ver
    Excel 2016,2016,365
    Posts
    85

    Re: Search two columns and if value is shown in another column then return Yes/No

    Thanks Geoff, that has worked for me(2013), maybe I should have said I was trying to do it on excel sharepoint online version and for some reason it doesnt work on that

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider (Windows 11 64-bit)
    Posts
    52,349

    Re: Search two columns and if value is shown in another column then return Yes/No

    Firstly, please update your forum profile to show the versions you are now using.

    There is nothing in that formula that should not work in a SharePoint hosted workbook. Define "doesn't work" - in what way? Error message? Are you changing the formula to reference another workbook? We need more detail.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  7. #7
    Registered User
    Join Date
    08-13-2009
    Location
    Glasgow
    MS-Off Ver
    Excel 2016,2016,365
    Posts
    85

    Re: Search two columns and if value is shown in another column then return Yes/No

    Hi Ali,

    Ok, so it does work. However, Columns A & B have at least 2500 rows while column C around 700, so when column C row is empty its returning "Yes".

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider (Windows 11 64-bit)
    Posts
    52,349

    Re: Search two columns and if value is shown in another column then return Yes/No

    OK - try this:

    =IF(C2="","",IF(COUNTIFS($A$2:$b$100,C2)>0,"yes","no"))

    Your lookup range isn't long enough, though ...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 13
    Last Post: 06-25-2014, 09:48 AM
  2. Pick item in column to be shown in line and columns
    By kuzna26 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2014, 05:30 AM
  3. SEARCH 3 columns and return column label
    By rnomis in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-09-2013, 07:06 AM
  4. Search for value in multiple columns, Return Column Headers
    By Zach51215 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-30-2013, 06:49 AM
  5. [SOLVED] VLOOKUP to search multiple columns and return value from single column
    By BBExcelusr in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 08-01-2012, 01:12 PM
  6. Search in Mulitple Columns and Return Corresponding Column/Row Result
    By JLRO in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 05-05-2008, 10:42 AM
  7. Column of Text Shown = Total Times Shown?
    By philcassell in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-19-2006, 02:25 AM

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