How to extract data betwee to quotes..?

mohanyathish

New Member
Joined
Apr 21, 2011
Messages
48
i have the following data in A1..

john said, "I AM IN LOVE" in his latest tale of fantasy.

i need this data in B1...

I AM IN LOVE

Sometimes it so happens that I have data like....

The tall guy, said, "THE NAME OF THE PLAY IS "BEAUTIFUL", BUT "CONFUSING"", after the play.

what i need is...

THE NAME OF THE PLAY IS "BEAUTIFUL", BUT "CONFUSING"

can anybody suggest a formula to extract data between quotes..?
(The first " and the last ")

thanks in advance.....

-------------------------------

what i know is a drop....what i dont know is an ocean....
 
Last edited:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try

=MID(A1,FIND(CHAR(34),A1)+1,FIND(CHAR(34),SUBSTITUTE(A1,CHAR(34),"~",1))-FIND(CHAR(34),A1)-1)

Edit: I didn't see your edit before posting. My formula will only work with your first example.
 
Last edited:
Upvote 0
Can you use a VB user defined function (UDF)?

Code:
Function GetQuote(S As String) As String
  GetQuote = Mid(S, InStr(S, """") + 1, InStrRev(S, """") - InStr(S, """") - 1)
End Function
If you are not familiar with UDFs, you would install it by pressing ALT+F11 from any worksheet. This will open the VB editor.... once there, click Insert/Module on its menu bar and copy/paste the above code into the code window that just opened up. That's it. Go back to your worksheet and enter this into a cell (assuming A1 contains your text)...

=GetQuote(A1)
 
Upvote 0
Hi

Same as Peter's, just adapted to account for a case like the second example:

=MID(A1,FIND("""",A1)+1,FIND("|",SUBSTITUTE(A1,"""","|",LEN(A1)-LEN(SUBSTITUTE(A1,"""",""))))-FIND("""",A1)-1)


<table border="1" cellpadding="1" style="background:#FFF; border-collapse:collapse;border-width:2px;border-color:#CCCCCC;font-family:Arial,Arial; font-size:10pt" ><tr><th style="border-width:1px;border-color:#888888;background:#9CF " > </th><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" >A</th><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" >B</th><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >C</th></tr><tr><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;background:#9CF; text-align:center; " ><b>1</b></td><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;text-align:left;border-width: 1px;border-color:#888888; ">john said, "I AM IN LOVE" in his latest <br>tale of fantasy</td><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;text-align:left;border-width: 1px;border-color:#888888; ">I AM IN LOVE</td><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;text-align:right;border-width: 1px;border-color:#888888; "> </td></tr><tr><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;background:#9CF; text-align:center; " ><b>2</b></td><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;text-align:left;border-width: 1px;border-color:#888888; ">The tall guy, said, "THE NAME OF THE PLA<br>Y IS "BEAUTIFUL", BUT "CONFUSING"", afte<br>r the play.</td><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;text-align:left;border-width: 1px;border-color:#888888; ">THE NAME OF THE PLAY IS "BEAUTIFUL", BUT<br> "CONFUSING"</td><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;text-align:right;border-width: 1px;border-color:#888888; "> </td></tr><tr><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;background:#9CF; text-align:center; " ><b>3</b></td><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;text-align:right;border-width: 1px;border-color:#888888; "> </td><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;text-align:right;border-width: 1px;border-color:#888888; "> </td><td style="border-width:1px;border-color:#000000; padding-left:0.5em; padding-top:0.4em; padding-right:0.5em; padding-bottom:0.25em;text-align:right;border-width: 1px;border-color:#888888; "> </td></tr><tr><td colspan=4 style="background:#9CF; padding-left:1em" > [Book1]Sheet3</td></tr></table>
 
Upvote 0
I am ok fine with UDFs....

but the suggested UDF doesnt seem to work....

could you suggest any other solution..?
:confused:
Did you install it where I suggested? Did you change the cell reference in the formula? The code was tested before I posted it and it worked fine for the examples you posted. Does it not work for any of your text? If it works for some, but not all, please post the text it is not working for.
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,702
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top