+ Reply to Thread
Results 1 to 8 of 8

Lookup partial values and if match return partial value from another cell

  1. #1
    Registered User
    Join Date
    11-02-2016
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    21

    Lookup partial values and if match return partial value from another cell

    Hi,

    I've been searching what feels like everywhere for a solution. I understand it might not be simple.

    I have attached a file containing an example. In the sheet Expected result you can see what value I expect the formula to return in to H2-H6.

    The example is short but I need a formula in the H column (Sheet Workbook 1) that does the following:

    Take the first word in E-cell, for example E2 and the first number and the last word, in this case New, 6202 and accounting. I then need the formula to search in (Sheet Workbook 2) column D for a match on New, 6202 and accounting. If the formula finds a match I need it to return the value from adjacent C column but removing the searched number, in this case 6202 and only return 10.

    The reason I need this setup is that both workbooks contain thousands of rows and the data can be changed from one time to another. But the target number will always be found in the same way.

    Anyone that can think of a solution for my problem?

    Br
    René
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,371

    Re: Lookup partial values and if match return partial value from another cell

    Something like this:

    =LEFT(INDEX('Workbook 2'!F2:$F$8,MATCH('Expected Result'!A2,'Workbook 2'!$E$2:$E$8,0)),2)
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (Version 2503 Build 16.0.18604.20000) 64-bit
    Posts
    3,992

    Re: Lookup partial values and if match return partial value from another cell

    Try

    H2
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ...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.

    Or

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by shukla.ankur281190; 08-01-2017 at 05:34 AM. Reason: Locking the cell
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Lookup partial values and if match return partial value from another cell

    In your example, you can use a straightforward match, as Ali posted.

    But from your description, I'm guessing that your real data has non identical cells, which you want to match based only on first word, number and last word.

    If my understanding is correct, then both these values should return the same prefix from Workbook 2:

    Stockholm cc 8131 Central Projects
    Stockholm City Centre 8131 Suburban Projects


    So we look up Stockholm | 8131 | Projects, and return prefix 40. Is that correct?

    If that logic is sound... then you can do this quite easily using Power Query.

    fnRemoveAllText:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Table1: (load this to your output table)
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Table2: (load to connection only)
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Now you can simply refresh the query to update your output table.


    Worked example attached.
    Attached Files Attached Files
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  5. #5
    Registered User
    Join Date
    11-02-2016
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    21

    Re: Lookup partial values and if match return partial value from another cell

    Thanks you everyone for the examples.

    Thread is solved and it works very well!

    BR
    René

  6. #6
    Registered User
    Join Date
    11-02-2016
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    21

    Re: Lookup partial values and if match return partial value from another cell

    Quote Originally Posted by shukla.ankur281190 View Post
    Try

    H2
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ...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.

    Or

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Thank you! The second formula nailed it!

    @Olly yes you are right on what I'm trying to achieve. Sadly I don't have Power Query but looking at your attached result it seems to do what I'm trying to achieve.

  7. #7
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Lookup partial values and if match return partial value from another cell

    Quote Originally Posted by Renejorgensen View Post
    @Olly yes you are right on what I'm trying to achieve. Sadly I don't have Power Query but looking at your attached result it seems to do what I'm trying to achieve.
    Power Query is a free addin for Excel 2013: https://www.microsoft.com/en-gb/down....aspx?id=39379

    I strongly recommend installing it, and learning how to use it.

  8. #8
    Registered User
    Join Date
    11-02-2016
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    21

    Re: Lookup partial values and if match return partial value from another cell

    Quote Originally Posted by Olly View Post
    Power Query is a free addin for Excel 2013: https://www.microsoft.com/en-gb/down....aspx?id=39379

    I strongly recommend installing it, and learning how to use it.
    I will raise the question to our IT department Normally they install all additions and new programs for safety reasons.

+ 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. VBA code to partial match and return all values
    By MiltonSilva in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2014, 10:09 AM
  2. Replies: 9
    Last Post: 05-02-2014, 11:04 PM
  3. [SOLVED] need to do Partial name search and return the value against the partial name
    By Kiran Kurapati in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2013, 09:40 AM
  4. [SOLVED] Check if Cell Contains any values from a list, partial match
    By scottclayton in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-22-2013, 05:39 AM
  5. Formula needed to return values for partial or full match
    By IntRes in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-07-2012, 08:32 AM
  6. Lookup multiple partial match conditions and return values
    By darklans in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 04-18-2012, 03:26 AM
  7. Return cell contents on a partial match
    By rhani111 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-04-2008, 12:13 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