+ Reply to Thread
Results 1 to 13 of 13

Index match looking using part of a string

  1. #1
    Forum Contributor
    Join Date
    06-17-2015
    Location
    Norwich, England
    MS-Off Ver
    2016 (Office 365)
    Posts
    103

    Index match looking using part of a string

    Hi

    I successfully use INDEX/SMALL formulas to extract all the rows that have a cell containing a value equal to that in a source cell -

    For example - I give my customers a 'shortname' (Smi for Smiths or Smithson or Smithy etc)

    for example

    =IFERROR(INDEX(dgts_current!$A$3:$N$10000,SMALL(IF(dgts_current!$E$3:$E$10000=$C$23,ROW(dgts_current!$E$3:$E$10000)),ROW(1:1))-2,1),"")

    Where C23 is my source cell

    I can then list all of those customers who have a shortname of Smi

    What I'm trying to do now is to find a way of missing out the three-letter shortname column

    So if I type 'Sm' into a source cell I want to generate a list of all customers whose name starts with 'Sm'

    I've found one or two near-misses but nothing that does exactly what I'm after - any ideas?

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Index match looking using part of a string

    Sure. If you create a small, representative sample of your data along with the desired output of the formula/s, we should be able to solve this for you in no time.

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Index match looking using part of a string

    I'd recommend uploading sample file. It's difficult / more work for us to help you without it.

    To upload file, "Go Advanced" button in Thread edit/post tool and use "Manage Attachments" found in "Additional Options".
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  4. #4
    Forum Contributor shivya's Avatar
    Join Date
    08-19-2017
    Location
    Delhi, India
    MS-Off Ver
    2013
    Posts
    240

    Re: Index match looking using part of a string

    Quote Originally Posted by Andy Swain View Post
    Hi

    I successfully use INDEX/SMALL formulas to extract all the rows that have a cell containing a value equal to that in a source cell -

    For example - I give my customers a 'shortname' (Smi for Smiths or Smithson or Smithy etc)

    for example

    =IFERROR(INDEX(dgts_current!$A$3:$N$10000,SMALL(IF(dgts_current!$E$3:$E$10000=$C$23,ROW(dgts_current!$E$3:$E$10000)),ROW(1:1))-2,1),"")

    Where C23 is my source cell

    I can then list all of those customers who have a shortname of Smi

    What I'm trying to do now is to find a way of missing out the three-letter shortname column

    So if I type 'Sm' into a source cell I want to generate a list of all customers whose name starts with 'Sm'

    I've found one or two near-misses but nothing that does exactly what I'm after - any ideas?
    Please attach your sheet.

  5. #5
    Forum Contributor
    Join Date
    06-17-2015
    Location
    Norwich, England
    MS-Off Ver
    2016 (Office 365)
    Posts
    103

    Re: Index match looking using part of a string

    Hi - I've uploaded a file called Testnames.xlsm with a short example list of names in sheet2 and example entry in sheet1 - thanks
    Attached Files Attached Files

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Index match looking using part of a string

    With "PE" in A3 of Sheet1, in A6 of Sheet1, try this:

    =IFERROR(INDEX(Sheet2!A$2:A$10,SMALL(IF(LEFT(Sheet2!A$2:A$10,2)=A$3,ROW(Sheet2!A$2:A$10)-(ROW(Sheet2!A$2)-1)),ROWS(A$1:A1))),"") Ctrl Shift Enter

    Copy the formula down as far as needed.

  7. #7
    Forum Contributor
    Join Date
    06-17-2015
    Location
    Norwich, England
    MS-Off Ver
    2016 (Office 365)
    Posts
    103

    Re: Index match looking using part of a string

    That works with 2 letters (PE) will it work if I narrowed the range down to PET or PETE?

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Index match looking using part of a string

    Sure, just change 2 to LEN(A$3). That is,

    =IFERROR(INDEX(Sheet2!A$2:A$10,SMALL(IF(LEFT(Sheet2!A$2:A$10,LEN(A$3))=A$3,ROW(Sheet2!A$2:A$10)-(ROW(Sheet2!A$2)-1)),ROWS(A$1:A1))),"") Ctrl Shift Enter

  9. #9
    Forum Contributor
    Join Date
    06-17-2015
    Location
    Norwich, England
    MS-Off Ver
    2016 (Office 365)
    Posts
    103

    Re: Index match looking using part of a string

    Many thanks - works a treat!

  10. #10
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Index match looking using part of a string

    You're welcome. Happy to help.

    Thanks for the rep!

    If that solved your question, please mark this thread as SOLVED.

  11. #11
    Forum Contributor
    Join Date
    06-17-2015
    Location
    Norwich, England
    MS-Off Ver
    2016 (Office 365)
    Posts
    103

    Re: Index match looking using part of a string

    Sorry - one last thing - is it possible to search for PE or PET etc (fragment?) within the string (ie customer names)?

  12. #12
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Index match looking using part of a string

    Sure. That would be this:

    =IFERROR(INDEX(Sheet2!A$2:A$10,SMALL(IF(ISNUMBER(SEARCH(A$3,Sheet2!A$2:A$10)),ROW(Sheet2!A$2:A$10)-(ROW(Sheet2!A$2)-1)),ROWS(A$1:A1))),"") Ctrl Shift Enter

  13. #13
    Forum Contributor
    Join Date
    06-17-2015
    Location
    Norwich, England
    MS-Off Ver
    2016 (Office 365)
    Posts
    103

    Re: Index match looking using part of a string

    Many thanks - all sorted!

+ 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. Replies: 2
    Last Post: 09-27-2014, 04:34 PM
  2. [SOLVED] Need VLOOKUP help to match part of a string
    By rbergero in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 06-20-2014, 08:45 PM
  3. [SOLVED] INDEX MATCH based on part of strings
    By Dahlia in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 02-07-2014, 07:55 AM
  4. [SOLVED] VLOOKUP/ INDEX:MATCH part of string.
    By strud in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-17-2013, 12:04 PM
  5. How to match if cell contains some part of the string from other cells in other column?
    By kalucharan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2012, 05:40 AM
  6. Replies: 9
    Last Post: 11-22-2009, 03:04 PM
  7. Can Index & Match find a paticular part number
    By vane0326 in forum Excel General
    Replies: 0
    Last Post: 02-03-2005, 07:56 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