+ Reply to Thread
Results 1 to 6 of 6

Compare and search multiple columns, return text as answer

  1. #1
    Registered User
    Join Date
    12-08-2008
    Location
    San Diego, CA
    Posts
    2

    Compare and search multiple columns, return text as answer

    I'm having a total brain fart.
    I have a list in A, I need to search for that value in a list D, E, F, G. The value in A is in only one of the columns. I need to return the header name of each particular column in to B.

    I hope I explained this semi clearly. I think i attached a book with sample data. This list goes on for 900ish rows.
    Thanks in advanced for the help!
    -Josh
    Book1.xlsx

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: Compare and search multiple columns, return text as answer

    use the following formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Also, see Sheet2 on attached - Book12.xlsx
    HTH!

  3. #3
    Registered User
    Join Date
    12-08-2008
    Location
    San Diego, CA
    Posts
    2

    Re: Compare and search multiple columns, return text as answer

    With some tweaks I got this to work. You are beautiful.
    thank you!
    -J

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Compare and search multiple columns, return text as answer

    Here is another option (a bit messy)...
    =IF(ISERROR(MATCH(A2,$D$2:$D$11,0)),IF(ISERROR(MATCH(A2,$E$2:$E$11,0)),IF(ISERROR(MATCH(A2,$F$2:$F$11,0)),IF(ISERROR(MATCH(A2,$G$2:$G$11,0)),"","N"),"OR"),"R"),"O")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Compare and search multiple columns, return text as answer

    =IF(COUNTIF($D$2:$G$11,A2)=0,"Not Found",SUBSTITUTE(INDEX($A$1:$G$1,SUM(INDEX(($D$2:$G$11=$A2)*COLUMN($D$2:$G$11),0))),"GROUP ",""))
    Try this formula in "B2" and copy towards down
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: Compare and search multiple columns, return text as answer

    FDibbins,
    I was doing exactly that, but then I thought of using COUNTIF() instead of IFERROR(MATCH())

    Cheers!

+ 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. Compare text columns and return a value based on text
    By phxmafia in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2014, 10:50 AM
  2. Replies: 6
    Last Post: 02-28-2013, 11:27 AM
  3. How to compare and search columns for text?
    By tomlini in forum Excel General
    Replies: 4
    Last Post: 12-16-2012, 08:03 AM
  4. Compare values in two columns and return text from adjacent cell
    By MrBorders in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-04-2009, 04:54 AM
  5. Compare Values in Multiple Columns and return a result
    By edbhome in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-18-2009, 09:37 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