+ Reply to Thread
Results 1 to 6 of 6

How to extract the universities out?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-19-2010
    Location
    South Carolina
    MS-Off Ver
    Excel 2003
    Posts
    3

    How to extract the universities out?

    I have a column of data looking like this:

    School of Business, Rockefeller College of Public Affairs and Policy, State University of New York at Albany, 1400 Washington Avenue, Albany, NY 12222
    Bowling Green State University, Bowling Green, OH 43403
    Marketing Department, Wharton School, University of Pennsylvania, Philadelphia, PA 19104

    I want to keep only the university information which means transforming into sth like this:

    State University of New York at Albany
    Bowling Green State University
    University of Pennsylvania

    Does anybody have an idea on how do I do this?
    Last edited by Guang; 10-29-2010 at 08:04 PM.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to extract the universities out?

    Hi and welcome to the board

    You can select Data - Filter - AUtofilter - Clck dropdwon arrow - Select Custom - change the first drop-down to " does not contain" - enter the word university in the second field and click OK.
    Select all visible rows except headers - Right- click select delete - Remove the Filter - Done

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,636

    Re: How to extract the universities out?

    Probably some macro would solve it easily...

    =TRIM(RIGHT(SUBSTITUTE(LEFT(SUBSTITUTE(A1;",";"@";1+LEN(LEFT(A1;FIND("University";A1)))-LEN(SUBSTITUTE(LEFT(A1;FIND("University";A1));",";"")));FIND("@";SUBSTITUTE(A1;",";"@";1+LEN(LEFT(A1;FIND("University";A1)))-LEN(SUBSTITUTE(LEFT(A1;FIND("University";A1));",";""))))-1);",";REPT(" ";100));120))
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to extract the universities out?

    This little UDF will do it for you:
    Option Explicit
    
    Function FINDIT(RNG As Range, MyVal As String, _
        Optional Delim As String) As String
    Dim MyArr As Variant, Itm As Long
    
    If RNG.Cells.Count > 1 Then
        FINDIT = "1 cell only"
        Exit Function
    End If
    If Delim = "" Then Delim = ","
        
    MyArr = Split(Trim(RNG), Delim)
    
    For Itm = LBound(MyArr) To UBound(MyArr)
        If InStr(MyArr(Itm), MyVal) > 0 Then
            FINDIT = Trim(MyArr(Itm))
            Exit Function
        End If
    Next Itm
    
    FINDIT = "Not Found"
    End Function

    How to install the User Defined Function:
    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save as a macro-enabled workbook

    The function is installed and ready to use.

    ========
    How to Use:

    If the long text string is in A1, in an adjacent cell like B1 enter this formula:

    =FINDIT(A1, "University", ",")


    The function will return whichever substring within the long string holds the searched value. The substrings are denoted by the delimiter you set in the 3rd value.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    10-19-2010
    Location
    South Carolina
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: How to extract the universities out?

    Sorry for replying late.
    It works. Thanks a lot guys!

  6. #6
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to extract the universities out?

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1