Announcement

Collapse
No announcement yet.

Find Text Between Characters And Remove Hyphens

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Find Text Between Characters And Remove Hyphens

    I need to make a macro that will find text between "o/" and "/", remove hyphens from the text it found, and then add it to the end of the current cell contents.

    I know how to add to the end of current cell contents, but cannot figure out how to grab text between certain characters or replace hyphens and replace with spaces.

  • #2
    Re: Find Text Between Characters And Remove Hyphens

    If cell [A1] is "some chars o/gumpy-dumpy-sumpy/ other stuff"

    The following formula:

    =SUBSTITUTE(LEFT(MID(A1,FIND("o/",A1)+2,LEN(A1)),FIND("/",MID(A1,FIND("o/",A1)+2,LEN(A1)))-1),"-"," ")
    some chars o/gumpy-dumpy-sumpy/ other stuff
    gets you want you've asked for:

    gumpy dumpy sumpy

    That is, SUBSTITUTE() replaces characters, FIND() tells you locations of characters within strings, and MID() and LEFT() get you appropriate portions of strings.
    Last edited by Mark Wyld; September 19th, 2006, 05:13.

    Comment


    • #3
      Re: Find Text Between Characters And Remove Hyphens

      Thank you! That works great. Also thanks for the explanation of the code.

      Comment


      • #4
        Re: Find Text Between Characters And Remove Hyphens

        Or..

        =SUBSTITUTE(MID(A1,FIND("o/",A1)+2,SUM(FIND({"o^","/"},SUBSTITUTE(A1,"o/","o^"))*{-1,1})-2),"-"," ")

        HTH
        Kris

        ExcelFox

        Comment


        • #5
          Re: Find Text Between Characters And Remove Hyphens

          Sorry to dig up an old thread here but I have a really similar question and I'm sure someone here will be able to help. We're basically being attacked by negative SEO and they're using hosts and hosts of sub domains which we need to remove from our disavow.txt file. Let me try to explain.

          We have a list with things like this:

          domain:algology.digibookmarks.com
          domain:arolo.digibookmarks.com
          domain:jester.digibookmarks.com
          domain:clamp.digibookmarks.com
          domain:hah.digibookmarks.com

          We need to remove the text between "domain:" and the first "." So in the list above we need to remove algology and jester and clamp etc.

          Can anyone please help?

          Comment


          • #6
            Re: Find Text Between Characters And Remove Hyphens

            silkblooms,
            Welcome with us but open your thread and make reference to this one if you need.
            PCI
            Triumph without peril brings no glory: Just try

            Comment

            Working...
            X