How to turn formula into UDF?

On the site (http://excel.bigresource.com/Find-Text-String-Value-Between-Quotes-E2NXRK3A.html), I've found a formula that I'd like to turn into an UDF.

The formula (below) extracts a string that is contained between double/single quotes.

=MID(A1,FIND(")",A1,1)+2,45)

How do I change this formula into a UDF?

Function "ExtractTitle"
...
...
End Function

Btw, the currently formula includes the "" and ' ' upon extraction.   I really only need the text in between.   Any suggestions as to how the double/single quotes can be removed from the output?

EEH
ExpExchHelpAnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try

Function ExtractTitle(strText As String) As String

If strText Like "*'*" Then ' found single quote
    ExtractTitle = Split(strText, "'")(1)
ElseIf strText Like "*""*" Then ' found double quote
    ExtractTitle = Split(strText, Chr(34))(1)
Else            ' found nothing
    ExtractTitle = ""
End If
End Function

Open in new window

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ExpExchHelpAnalystAuthor Commented:
Perfect!   That'll do the trick.

I just realized though that some of my titles are not between either double or single quotes.

However, the bulk follows the following two examples"

Ackoff R (1999). Re-creating the Corporation.
Ackoff RL (1970a) A concept of corporate planning.


Bulk of pattern is:  
-  ). Title             .... that is ")" followed by a "." and then " "
-  ) Title             .... that is ")" followed " "

In this case, I need to catch the title (i.e., everything after between the two periods or everything between )&space to next period).

If you think this requires a different question, please let me know.

EEH
0
Rgonzo1971Commented:
Hi,

This should do it

Function ExtractTitle(strText As String) As String

If strText Like "*'*" Then ' found single quote
    ExtractTitle = Split(strText, "'")(1)
ElseIf strText Like "*""*" Then ' found double quote
    ExtractTitle = Split(strText, Chr(34))(1)
ElseIf strText Like "*)*" Then
    ExtractTitle = Trim(Replace(Mid(strText, InStr(1, strText, ")") + 1), ",", ""))
Else            ' found nothing
    ExtractTitle = ""
End If
End Function

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.