+ Reply to Thread
Results 1 to 16 of 16

Vlookup - create new list from existing list based on partial match

  1. #1
    Registered User
    Join Date
    05-12-2018
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9

    Vlookup - create new list from existing list based on partial match

    I'm trying to use formulae only to create a new list of data from a master data set using criteria in a lookup column.
    I'm hoping for my formula to follow these steps:
    1 Take value in E3.
    2 Lookup cells in A3:A14 partially containing value in E3.
    3 When a match is found, stop, copy complete value in column A plus adjacent value in column B. Add value to H & I column (H3:I3 for first entry in example)
    4 After first entry, formula will move to next row in column H (H4)
    5 Move to next row in column A and continue lookup.
    6 Repeat step 3 & 4 everytime a match is found.

    This is pretty much the jist of it. I'm new to formulae in excel so any help would be appreciated.
    vlookup is great but couldn't combine with other function to do step 4
    Attached Images Attached Images

  2. #2
    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
    80,856

    Re: Vlookup - create new list from existing list based on partial match

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one and nobody wants to have to recreate your data from scratch.

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

    2. Make sure that your desired results are also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as 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.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    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.

  3. #3
    Registered User
    Join Date
    05-12-2018
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9
    Please find attached a copy of the sample excel file as shown in the original query post.
    Hope this helps.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,259

    Re: Vlookup - create new list from existing list based on partial match

    If you can use helper columns, populate column G, for example with this formula in G3 and copy down:

    =IF(COUNTIF(A3,"*"&$E$3&"*"),A3,"")

    Then use this array formula (ctrl+shift+enter) in H3 and copy down:
    =IFERROR(INDEX($G$3:$G$14,MATCH(1,(COUNTIF(H$2:H2,$G$3:$G$14)=0)*($G$3:$G$14<>""),0)),"")

    And finally this lookup formula in I3 and down:
    =IFERROR(INDEX($B$3:$B$14,MATCH(H3,$A$3:$A$14,0)),"")
    Last edited by Estevaoba; 05-12-2018 at 01:18 PM.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Vlookup - create new list from existing list based on partial match

    In J3

    =IFERROR(INDEX(A$3:A$14,SMALL(IF(ISNUMBER(SEARCH($E$3,$A$3:$A$14)),ROW($A$3:$A$14)-ROW($A$3)+1,""),ROWS($A$3:A3))),"")


    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    Then copy across to K and down

    Repeat for other cells, changing highlighted cell
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-12-2018
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9
    Quote Originally Posted by JohnTopley View Post
    In J3

    =IFERROR(INDEX(A$3:A$14,SMALL(IF(ISNUMBER(SEARCH($E$3,$A$3:$A$14)),ROW($A$3:$A$14)-ROW($A$3)+1,""),ROWS($A$3:A3))),"")


    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    Then copy across to K and down

    Repeat for other cells, changing highlighted cell
    Many thanks.
    Now what if I wanted to, rather than have three separate lists corresponding to each value on my lookup set, have only one list comprising of values in column A containing values in my lookup set.

    Therefore the new list would contain all values in column A (below header) apart from A11 since it does not contain any values from lookup set.

    I tried changing the $E$3 to an array ($E$3:$E$5) but the SEARCH formula does not accept an array.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Vlookup - create new list from existing list based on partial match

    Try

    =IFERROR(INDEX($A$3:$A$14,SMALL(IF(--ISNUMBER(SEARCH({"LG","F3","LQ"},$A$3:$A$14)),ROW($A$3:$A$14)-ROW($A$3)+1,""),ROWS($A$3:$A3))),"")



    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  8. #8
    Registered User
    Join Date
    05-12-2018
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9
    Quote Originally Posted by JohnTopley View Post
    Try

    =IFERROR(INDEX($A$3:$A$14,SMALL(IF(--ISNUMBER(SEARCH({"LG","F3","LQ"},$A$3:$A$14)),ROW($A$3:$A$14)-ROW($A$3)+1,""),ROWS($A$3:$A3))),"")



    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Rather than inputting the exact values in the formula, is there no way of selecting a range of cells like E3:E5.

    Currently the criteria list is only three values, but could extend to up to 15 values (Master data set would also increase) which could make inputting values individually time consuming.

    Apologies for making the problem a little more complicated, but any help would be grateful.

  9. #9
    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,936

    Re: Vlookup - create new list from existing list based on partial match

    Not with that kind of formula - it wont accept a range. perhaps add a helper column to your data, then use VLOOKUP or some such, to add a 1 (or whatever code) to those rows you are interested in. Then just replace Johns { array} with that code
    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

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Vlookup - create new list from existing list based on partial match

    VBA offering:

    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Press Alt+F11 to open the Visual Basic Editor
    Choose Insert > Module
    Edit > Paste the macro into the module that appeared
    Close the VBEditor
    Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
    [B][I]
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    05-12-2018
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9

    Re: Vlookup - create new list from existing list based on partial match

    Thank you.

  12. #12
    Registered User
    Join Date
    05-12-2018
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9

    Re: Vlookup - create new list from existing list based on partial match

    Quote Originally Posted by JohnTopley View Post
    VBA offering:

    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Press Alt+F11 to open the Visual Basic Editor
    Choose Insert > Module
    Edit > Paste the macro into the module that appeared
    Close the VBEditor
    Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
    [B][I]

    Thank you John, however I'm trying to avoid using macro as this spreadsheet will be edited by several people and I'm not sure what their knowledge with VBA will be.
    I think, excel formulae would be simpler to comprehend.

    In your last excel formula below, I will try and use a helper column to create an array of strings from a range of cells. This would then be the input to your formula below

    =IFERROR(INDEX($A$3:$A$14,SMALL(IF(--ISNUMBER(SEARCH({"LG","F3","LQ"},$A$3:$A$14)),ROW($A$3:$A$14)-ROW($A$3)+1,""),ROWS($A$3:$A3))),"")

    Thank you.

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Vlookup - create new list from existing list based on partial match

    I tried it with a text string but it did not work (or could not get it to work!).

    And there no need for any knowledge of VBA,

    After entering data, all anyone has to do is click "RUN" !!!!

  14. #14
    Registered User
    Join Date
    05-12-2018
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9

    Re: Vlookup - create new list from existing list based on partial match

    Quote Originally Posted by JohnTopley View Post
    I tried it with a text string but it did not work (or could not get it to work!).

    And there no need for any knowledge of VBA,

    After entering data, all anyone has to do is click "RUN" !!!!
    The purpose it maximise the value of the spreadsheet.
    If I limit the number of people that can improve it, then it defeats the purpose.

    The list is as it seems now, however, the "lookup set" may expand to up to 20 values, or even something simple like moving "Master data set" to a different column may require a modification.
    People generally aren't accustomed to tweeking VBA in excel (intimidating to some), and would rather deal with excel formulae instead.

    I hope you can understand.

    I will close this query as solved. I appreciate you help.

    Have a lovely sunny day.

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Vlookup - create new list from existing list based on partial match

    The VBA could be amended to use named ranges so that the only change required is changing these, which is no more difficult than changing a range in a formula..

    Your reply suggests anyone, and everyone, can change a spreadsheet which does not strike me as a sensible procedure to adopt,

    But not my problem!!!

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Vlookup - create new list from existing list based on partial match

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

+ 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] Compare a list of strings against a list of keywords to return a partial match
    By randomkiwi in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-11-2017, 11:51 PM
  2. [SOLVED] Updating a Master List from a Partial List (VLOOKUP?)
    By jplunkett1 in forum Excel General
    Replies: 7
    Last Post: 07-15-2016, 11:19 AM
  3. [SOLVED] Formula to Create a Partial List from a Complete List
    By slindfors in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-18-2014, 02:44 PM
  4. Copy column based on partial word match in first row and paste into existing workbook
    By David Harris 1987 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-19-2013, 03:52 PM
  5. Copy column based on partial word match in first row and paste into existing workbook
    By David Harris 1987 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-11-2013, 01:02 PM
  6. Copying row based on partial cell match and paste into existing worksheets
    By colinh69 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2011, 02:42 PM
  7. Replies: 1
    Last Post: 06-05-2006, 10:40 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