Skip to Content

Extract the text between two specified start and end strings in a field

Hi there

I need to extract the text from between two specific strings in a field.

For example, the field may look like this:

#Metalwork - Enamel#Cabinet 4 Shelf 2###This is the label text I want to extract.####

I want to extract the text between ### and ####; in other words, I want to extract "This is the label text I want to extract."

Can anyone advise the formula I need to do this? I've tried several options that I've found on forums, but so far none work.

cheers

Karen

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Apr 16 at 01:06 PM

    Use the ExtractString function:

    ExtractString(Yourfield, "###", "####")
    Add comment
    10|10000 characters needed characters exceeded

  • Apr 16 at 11:51 AM

    You can use Instr() function

    Instr(YourField, '###') will return character number of first #

    Then use mid()

    Mid(Yourfield, Instr(YourField, '###')+3, Instr(YourField, '####')-1)

    Ian

    Add comment
    10|10000 characters needed characters exceeded

    • Hi there Ian

      Many thanks for your reply... I had just worked out how to do that when I saw your answer... then saw Ido had piped in with that ExtractString magic!

      cheers for your awesome response anyway :-)

      Karen