+ Reply to Thread
Results 1 to 10 of 10

Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

  1. #1
    Registered User
    Join Date
    01-15-2019
    Location
    Miami
    MS-Off Ver
    2016
    Posts
    66

    Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

    Hi everyone,

    I need a formula that will search for the person's name and then search for a specific text string in the adjacent column (e.g. "commitment:") and bring me the row that contains that text string. I pasted the image with desired result below. I know how to do this bringing the text string cell in order of appearance but I really want to tie this to the person's name in case they switch orders.

    Hope someone can help!


    excel example.JPG

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

    Are they always in the same order?

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please don't attach a picture of an Excel sheet (no-one will want to re-type all your stuff before starting).

    1. It does NOT have to be your real sheet - mock up a SAMPLE if you need to. But not 1000's of rows!!! It makes manual checking so tedious. Whatever you do... make sure that all confidential information is removed first!!

    2. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    3. Make sure that your desired solution is also shown (mock up the results manually).

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    01-15-2019
    Location
    Miami
    MS-Off Ver
    2016
    Posts
    66

    Re: Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

    I attached the sample file.

    There is no set number of lines, so I typically just use the entire column (A:A for example).

    They are currently in the same order but that can change, which is why I'm trying to tie it to the name of the person and the specific text string, so that if anything changes it will still always bring the correct result.

    Let me know if you need any more info.

    Thank you!
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

    In E2, copied down:
    =IFERROR(INDEX($A$2:$A$17,MATCH(0,INDEX(COUNTIF($E$1:$E1,$A$2:$A$17),0),0)),"")

    In F2, copied acorss and down:
    =INDEX($B$2:$B$17,MATCH(1,INDEX(($A$2:$A$17=$E2)*(ISNUMBER(SEARCH(F$1,$B$2:$B$17))),0),0))
    Attached Files Attached Files

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

    It's not a hugely good idea to use whole column references... unless you have 1,000,000 + rows.

    However, with a little tweak, the formula can be made future-proof.

    The revised formula in E2 is an array formula:
    =IFERROR(INDEX(A$2:A$1000,MATCH(0,IF(A$2:A$1000<>"",COUNTIF(E$1:E1,A$2:A$1000)),0)),"")

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-15-2019
    Location
    Miami
    MS-Off Ver
    2016
    Posts
    66

    Re: Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

    Thanks Glenn! This worked great!!

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  8. #8
    Registered User
    Join Date
    01-15-2019
    Location
    Miami
    MS-Off Ver
    2016
    Posts
    66

    Re: Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

    Hi Glenn,

    Quick question. Is there a way to update the formula you created to bring the second match it finds instead of the first match? I pasted the formula below and updated the sample file again with an example.

    But basically it would just be for 1 of my lines that have duplicate text, so for this one I just want to modify the formula to bring the second result.

    =IFERROR(INDEX($B$2:$B$100,MATCH(1,INDEX(($A$2:$A$1000=$E2)*(ISNUMBER(SEARCH(F$1,$B$2:$B$100))),0),0)),"")
    Attached Files Attached Files

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

    Most things are possible:


    =IFERROR(INDEX($B:$B,AGGREGATE(15,6,ROW($B$2:$B$100)/(($A$2:$A$1000=$E2)*(ISNUMBER(SEARCH(F$1,$B$2:$B$100)))),COUNTIF($F$1:F$1,F$1))),"")

    see sheet.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-15-2019
    Location
    Miami
    MS-Off Ver
    2016
    Posts
    66

    Re: Vlookup name in column 1 and text string in column 2 and bring that cell in column 2

    Thanks so much!

+ 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. [SOLVED] VBA Macro to find text string in one column and replace specific text in another column if
    By bmahfood in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-21-2017, 11:15 AM
  2. [SOLVED] If Column A Contains B1 Text String, Display Column A Cell
    By portokie in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-30-2015, 04:25 PM
  3. [SOLVED] Use Vlookup to compare A & B columns, and bring specific text from column C
    By Dee2015 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-04-2015, 12:21 PM
  4. [SOLVED] To Find if a text string contains key words in column B and C and set to value in column D
    By alice2011 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-27-2015, 11:42 AM
  5. Replies: 1
    Last Post: 12-10-2013, 05:23 PM
  6. Replies: 3
    Last Post: 08-29-2010, 03:31 PM
  7. How to bring text to cell from column
    By rcurious in forum Excel General
    Replies: 7
    Last Post: 07-04-2010, 12:38 PM

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