Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Joliette, Quebec, Canada
    Posts
    290
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Sring extraction (2000 SP3)

    Need to extract web page address from this string

    Doe, John#http://www.parl.gc.ca/information/ab...ery=19999&s=M#

    that is everything between the number signs

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sring extraction (2000 SP3)

    Say that the field or control or variable that contains the string is named WebAddress. The following expression will return the middle part:

    Left(Mid([WebAddress], InStr([WebAddress], "#") + 1), InStr(Mid([WebAddress], InStr([WebAddress], "#") + 1), "#") - 1)

    <img src=/S/blackteeth.gif border=0 alt=blackteeth width=20 height=20>

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Sring extraction (2000 SP3)

    or:
    Replace([WebAddress],"#","",InStr([WebAddress],"#"))
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sring extraction (2000 SP3)

    There could be a subaddress after the second #. Your expression won't handle that correctly. However, if there are no subaddresses, your expression is MUCH simpler to use.

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Sring extraction (2000 SP3)

    Good point - I never considered subaddresses. Sadly, Replace() won't accept a wildcard either.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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