+ 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
    92

    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, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,811

    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.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

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

    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
    2,807

    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
    92

    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
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,403

    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!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

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

    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
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,403

    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