+ Reply to Thread
Results 1 to 21 of 21

Formula to find the part of string.

  1. #1
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Formula to find the part of string.

    Hello,

    I am looking for a help to write a formula for an string. Let say if the string match another part of string in other column then returns the string mentioned in range. I am looking for a text from new list column B to mater list column B.

    If complete text or part of that text found the following should be done.

    1. Write the column C value from master list to new list column C (To know which category)

    2. Write the complete string from master list to new list column D (To know what is the match of text so that the user can cross check)

    3. Write the row number in column E (To know which row number so that the user can goto that row directly)

    I hope this will clear yourself to understand what i am trying to achieve.

    Thanks for your efforts to help me.
    Last edited by hecgroups; 04-20-2012 at 04:28 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Formula to find the part of string.

    I think you forgot something...
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Formula to find the part of string.

    You're going to have to explain this a bit better, Hec. Your post offers no details whatsoever.

    Generally speaking, I would encourage you to research =LEFT, =RIGHT, =MID, =LEN; each of which functions under the text/string manipulation subcategory.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  4. #4
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Formula to find the part of string.

    Quote Originally Posted by AlvaroSiza View Post
    You're going to have to explain this a bit better, Hec. Your post offers no details whatsoever.

    Generally speaking, I would encourage you to research =LEFT, =RIGHT, =MID, =LEN; each of which functions under the text/string manipulation subcategory.
    And perhaps in combination with =FIND().

  5. #5
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Formula to find the part of string.

    Quote Originally Posted by Søren Larsen View Post
    And perhaps in combination with =FIND().
    And further...

    =SEARCH, =SEARCHB...

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formula to find the part of string.

    I am looking for help.
    Press the F1 key.

  7. #7
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Formula to find the part of string.

    Quote Originally Posted by Cutter View Post
    Press the F1 key.
    Classic. ROFL.

  8. #8
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Formula to find the part of string.

    I am unable to post a new topic since last 3 days due to some technical problem.

    here is the original reply.

    Hello,

    I am looking for a help to write a formula for an string. Let say if the string match another part of string in other column then returns the string mentioned in range. I am looking for a text from new list column B to mater list column B.

    If complete text or part of that text found the following should be done.

    1. Write the column C value from master list to new list column C (To know which category)

    2. Write the complete string from master list to new list column D (To know what is the match of text so that the user can cross check)

    3. Write the row number in column E (To know which row number so that the user can goto that row directly)

    I hope this will clear yourself to understand what i am trying to achieve.

    Thanks for your efforts to help me.

    Sample file is attached for more clarification.
    Attached Files Attached Files
    Last edited by hecgroups; 04-20-2012 at 04:27 AM.

  9. #9
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Formula to find the part of string.

    Please Login or Register  to view this content.
    I hope that helps.
    .?*??)
    `?.???.?*??)?.?*?)
    (?.?? (?.?
    Pichingualas <---
    ??????????????????????????

    Wrap your code with CODE TAGS.
    Thank those who helped you, Don't forget to add to their REPUTATION!!! (click on the star below their post).
    Please mark your threads as [SOLVED] when they are (Thread Tools->Mark thread as Solved).

  10. #10
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Formula to find the part of string.

    Hai Pichingualas,

    Thanks for your solution. Right now i am sick and unable to provide you the feedback. but i will when i feel better.

    Thanks once again.

  11. #11
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Formula to find the part of string.

    Hai Pichingualas,

    Your script working as a magic for me. But there is another request for the same.

    I have checked on my original data and find the issues which is as follows:-

    1. The script should check the word uptill first space then return the service type in column C. If the first word not found then look for second word uptill space. See the example below for more clarification.

    Example: Assuming the word i am looking for is NASAL TUBE SUCTION.

    So the script should look for NASAL and return the service type in column C if not found then look for word TUBE so on...

    2. The service type is repeating more then one i.e. Other Medical Services, Other Medical Services which should not be. If one service type is already assigned then it should skip that type unless it is changed. See the example below for more clarification.

    Example: Assuming the word i am looking for is NASAL TUBE SUCTION and found NASAL

    So the script should return the service type as Other Medical Services just once not 2 times.

    I how this will clear i hope the above explanation is clear to you for finished this issue.

  12. #12
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Formula to find the part of string.

    This should be it:

    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Formula to find the part of string.

    Thank very much Pichingualas.

    It works like magic. I will cross check with other list if i don't find any issues then i will marked this topic as solved and reputation will be added.

    Tomorrow i will provide my feedback.

    Thanks once again for your valuable script.

  14. #14
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Formula to find the part of string.

    Happy to help.

  15. #15
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Formula to find the part of string.

    Hai Pichingualas

    I have an issue. There are some common service types which is available in master sheet but it is not displaying after running the script.

    For example:- Consultation, IGM, CBC, etc... these are the common services.

    Please see the attached file for more clarification.
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Formula to find the part of string.

    Sorry hecgroups I made a small mistake. It's marked in red, check if it works as you want with this correction:

    Please Login or Register  to view this content.

  17. #17
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Formula to find the part of string.

    Thanks for your help. I have one more request. Can I be possible same theory but apply when complete cell value match. Example: If I found urine analysis thn it should return service type.

    I hope you have got me what am asking.

  18. #18
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Formula to find the part of string.

    If you want to apply when the complete value matches then you will again have the problem with consultation you were saying before... This is because it would have to contain exactly the complete value, so for instance "CONSULTATION – DENTIST" would not match "CONSULTATION FEE - DENTIST SPECIALIST + FILE OPEN" because the word FEE is missing. we could loop it to check that each of the wrods is present but I think it would slow you down. If you don't mind then I can do it, so it's your call.

  19. #19
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Formula to find the part of string.

    Actually this is my boss call he wants like this. It is said to me if the complete value match then it should return the service type otherwise leave it blank.

    But please marked the line where i can change the column of result i.e. service type. At present it is displaying in column C but might me it will be displayed in column M or column P. If this is not possible then doesn't matter. I will manage.

    So, if you are searching for complete value then it will not slow down your script.

    I hope this is clear to you what i want to achieve.

    Thanks for your usual cooperation.

  20. #20
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Formula to find the part of string.

    Ok here goes:

    Please Login or Register  to view this content.
    I hope that's what you wanted.
    Last edited by Pichingualas; 05-18-2012 at 03:34 PM.

  21. #21
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Formula to find the part of string.

    Excellent script. Thanks for your halpe brother. Topic closed and reputation added.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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