Consulting

Results 1 to 5 of 5

Thread: Remove part of a string

  1. #1
    VBAX Regular
    Joined
    Aug 2016
    Posts
    12
    Location

    Remove part of a string

    i am trying to remove all of string before the first , but when i do find and replace it remove all of string before upto last ,
    please advise please find example

    3340 30MAR18 C , B AND M RETAIL , AVONMEADS GB

    just want to remove just to the left of the first ,

  2. #2
    VBAX Contributor rollis13's Avatar
    Joined
    Jun 2013
    Location
    Cordenons
    Posts
    146
    Location
    Supposing your data is in cell A1 you could use:
    =MID(A1,FIND(",",A1,1)+1,LEN(A1))
    or without extra spaces:
    =TRIM(MID(A1,FIND(",",A1,1)+1,LEN(A1)))

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Is this Word or Excel? You posted in the Excel forum so I assume it's an Excel question

    rollis13 gave you a Excel formula in Post#2. Did it work?

    Your post#1 was titled "Remove part of string" and your post #3 (since deleted) was titled "help Edit string"

    Also somehow the same 3 posts are in another thread marked Moved, but I can't see where from or to


    So to try and clean this up

    1. I deleted the 'Moved' duplicate copy of the thread

    2. I deleted your repeat in Post #3 of the original question

    If rollis13's worksheet formula works for you, you can mark the thread solved
    Last edited by Paul_Hossler; 01-05-2022 at 11:40 AM. Reason: typos
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #4
    VBAX Regular
    Joined
    Aug 2016
    Posts
    12
    Location
    All the srring is in b2 when I change your line to b2 it just returns the word value.
    What am I doing wrong

  5. #5
    VBAX Contributor rollis13's Avatar
    Joined
    Jun 2013
    Location
    Cordenons
    Posts
    146
    Location
    With your string in B2 the formulas become:
    =MID(B2,FIND(",",B2,1)+1,LEN(B2))
    or:
    =TRIM(MID(B2,FIND(",",B2,1)+1,LEN(B2)))
    You can use the formula in any other cell of the sheet except in B2. If used in other sheet you need to add the reference to the sheet where your data is.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •