Re: Extract Data



Depends where you are doing it, and if you can guarantee the quotes will be
there. For eexample ina query you can use:
Instr will return the position of the first quote
Using this value do another Instr to get the 2nd quote
Use Mid to extract out the section you want.


Or, do this if in VBA

Function GetMiddleBit(strInput as string) as string

Dim strResults() As String
strResults = Split( " " & strInput & " ", Chr(34))
GetMiddleBit = strResults(1)
End Function

and to test


Dim strTest As String
strTest = GetMiddleBit("Hello " & Chr(34) & "world" & Chr(34) & " How are
you?")



"Tony" <Tony@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:185794A8-CA08-4CA9-A0C5-D61357F77B00@xxxxxxxxxxxxxxxx
>I need to extract a portion of a text field and I don't have a clue how to
>do
> it. I know it can be done because I recall seeing someone else do it but
> for
> the life of me I cannot remember.
>
> Basically I have a text field that contains some information in the middle
> of it that is surounded by quotes and I need to extract only that part.
> Can
> someone tell me how I can extract it?
>
> Thank you in advance,
> Tony


.



Relevant Pages

  • Re: nested field separators
    ... quotes" as defined there as a contiguous pair of double quotes, to convert tabs in the original file to spaces and to only use a comma as the separator by default, instead of a comma followed by a space as in the OP. ... So, the script is now: ... # decsv_fs = the string to replace a FS within fields with. ... $0 = $0 decsv_rs inStr ...
    (comp.lang.awk)
  • Re: extract anything between escape characters
    ... I just want to extract the character ... KA> so that $string1 would be 'this is the string' without the double quotes. ...
    (perl.beginners)
  • Re: Copy only part of text string
    ... InStrcould be used to spot the word Error: ... Note that I appended the searched string to the initial string, ... Indeed, if the string is not found, InStr returns 0 and Mid ... don't need to extract. ...
    (microsoft.public.access.queries)
  • Find wildcard text within a cell
    ... I need to run a loop search where I find a cell in a particular column ... and I need to extract that string to a variable. ... The two strings in quotes are what I need to extract. ...
    (microsoft.public.excel.programming)
  • Regular Expressions
    ... I am trying to use Regex to help me do the following task. ... I have the following string ... and would like to extract the text between the last 2 quotes. ...
    (microsoft.public.dotnet.languages.csharp)