+ Reply to Thread
Results 1 to 10 of 10

function to match values in 3 columns

  1. #1
    Registered User
    Join Date
    02-23-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    6

    function to match values in 3 columns

    Hi Excel Experts,

    I am trying to match a value from column 1 and check if it exist in col 2 and col 3.

    If yes, then output the value(col 1) in the 4th column or just display "true"

    Sample:
    col1 col2 col3 col4
    1 0 2 1 or true <- true because there is "1" in col 2 and col 3
    2 0 1
    3 1 0
    4 3 5
    5 5 6 5 or true


    Thanks in advance for the help!!
    Last edited by brichigo; 05-10-2012 at 11:33 AM.

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: function to match values in 3 columns

    Assuming col1 = A, col2=B, col3=C...Then you would put this in the 4th column and copy/paste down.
    =OR(A1=B1,A1=C1)

    adjust to fit your ranges
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: function to match values in 3 columns

    Hi

    Try,

    =if(or(a1=b1;a1=c1);a1;"")


    edit: Change the semi colons to comma, if you have to do this.
    Last edited by Fotis1991; 05-10-2012 at 11:10 AM. Reason: edit
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: function to match values in 3 columns

    Hello the below formula should work for you

    Please Login or Register  to view this content.
    Thanks,

    RVASQUEZ

  5. #5
    Registered User
    Join Date
    02-23-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: function to match values in 3 columns

    Hi All!

    Thanks for the quick response.

    My goal is to check if the value in col A is also found in both col B AND col C in any order.

    I have attached a sample workbook. thanks much!
    Attached Files Attached Files

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

    Re: function to match values in 3 columns

    Try
    =AND(ISNUMBER(MATCH(A2,B:B,0)),ISNUMBER(MATCH(A2,C:C,0)))

  7. #7
    Registered User
    Join Date
    02-23-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: function to match values in 3 columns

    Quote Originally Posted by Cutter View Post
    Try
    =AND(ISNUMBER(MATCH(A2,B:B,0)),ISNUMBER(MATCH(A2,C:C,0)))
    Hi Cutter,

    This is perfect! Thank you!!

    Thank you all! I really appreciate your help!

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

    Re: function to match values in 3 columns

    You're welcome. Thanks for the 'star tap'. Don't forget to mark your thread as SOLVED (click on Forum Rules at top of page for instructions if needed).

  9. #9
    Registered User
    Join Date
    02-23-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: function to match values in 3 columns

    Hi Cutter/All,

    What if im looking for a common value that exist in 3 columns in any order?

    Then output that common value in the 4th column.
    Thanks again!

  10. #10
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: function to match values in 3 columns

    hmmm...how about the following choose statement:

    =CHOOSE(1+1*(A1=B1)+2*(B1=C1)+3*(C1=A1),"",A1,B1,C1,"","",A1)

    Looks like it works. The cases (1-7) happen in the following situations:

    1 = No common values
    2 = A,B common only
    3 = B,C common only
    4 = A,C common only
    7 = A,B,C common
    5 = can't happen
    6 = can't happen
    Last edited by GeneralDisarray; 05-11-2012 at 12:08 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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