+ Reply to Thread
Results 1 to 7 of 7

Find the index of substring in whole string in one cell

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,944

    Find the index of substring in whole string in one cell

    Hi Guys,

    it is cross posted here for formula solution:

    https://www.excelforum.com/excel-for...ml#post5583939

    In this topic i am looking for VBA solution - honestly formula from abovve topic is a magic for me, VBA i know better so it would be nice to compare solutions.

    i have joined string like here:

    "Vn_Input_HANA_Deployment_Description;Vn_Input_NetWeaver_Deployment_Description;Vn_Input_Oracle_Deployment_Description;Vn_Input_SBD_Deployment_Description;Vn_Input_Servers_Deployment_Description;Vn_Input_SharedStorage_Deployment_Description;Vn_Input_WebDispatcher_Deployment_Description"

    or here : "Vn_Input;Vn_Input;Vn_Input;Vn_Input;Vn_Input;Vn_Input"

    and now i have to lookup and find indexes for all matches in source table.

    So if i am looking for Vn_Input_HANA_Deployment_Description i would like to get "1" because it is the first substring in whole string.

    in second example where lookup value is: "Vn_Input" i would like to get 1;2;3;4;5;6 because i have everywhere matches.

    IT is possible with formula ? OR maybe VBA would better (if Yes admin please move to proper forum topics).

    I am attaching example workook to address.

    And in my source table i have also TableName to retrive.

    So generally steps i would take:
    1) find the row of source table where lookupvalue exists (we will not have duplicates here),
    i tried with :
    Copy to clipboard
    "=INDEX(Source!E2:E6;MATCH(LookUp!C4;Source!$E$2:$E$6;0))"
    but it is not working
    2) within found row check which position in string lookup value has and return index.
    3) if more than one matches return array as result.

    Thank you for help,
    Jacek
    Can anybody help with VBA solution?
    Best Wishes,
    Jacek
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Find the index of substring in whole string in one cell

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,944

    Re: Find the index of substring in whole string in one cell

    Thank you jindon,

    perfect solution!

    Best wishes,
    Jacek

  4. #4
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,944

    Re: Find the index of substring in whole string in one cell

    Hi jindon,

    Please Login or Register  to view this content.
    i do not catching what it is doing.
    It is setting a(i,2) AS arraylist right ?

    so a(i,2) is the arraylist now? Not array?

    It is like setting dictionary?

    Best,
    Jacek

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Find the index of substring in whole string in one cell

    Setting each second column of array to ArrayList for corresponding sub string of 1st column to get unique index and sort later.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Find the index of substring in whole string in one cell

    If this is easier to understand.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,944

    Re: Find the index of substring in whole string in one cell

    thank you jindon!

    Jacek

+ 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. Find the index of substring in whole string in one cell
    By jaryszek in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 10-21-2021, 06:16 AM
  2. [SOLVED] Find indexnumber of substring in string
    By MaartenRo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-19-2021, 06:11 AM
  3. [SOLVED] ForLoop to Find string value as part of substring in another cell
    By skydivetom in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2021, 05:19 PM
  4. Replies: 8
    Last Post: 03-09-2018, 11:39 AM
  5. [SOLVED] Find substring within a string, from a list
    By NotSwank in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-06-2014, 10:27 AM
  6. [SOLVED] Find the position of a substring in a string
    By nemo66ro in forum Excel General
    Replies: 6
    Last Post: 10-22-2012, 01:21 AM
  7. Find the sub string in column and copy the cell next to the substring
    By shrujan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2009, 11:00 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