+ Reply to Thread
Results 1 to 8 of 8

Match Text from one sheet to another and return text

Hybrid View

  1. #1
    Registered User
    Join Date
    10-09-2012
    Location
    Wichita, KS
    MS-Off Ver
    Excel 2010
    Posts
    2

    Match Text from one sheet to another and return text

    Hello - can someone help me with the attached sample file?

    I need to take the name of a school in (sheet 1,column E), search a list of school names on (sheet 2,Column A) to find that name, and return the corresponding cohort name from (sheet 2,column B) to (sheet 1,column F).
    I've included 6 examples, but our raw data sheet has 271,509 entries (student info attached to school info).

    Thanks!
    jb
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Match Text from one sheet to another and return text

    shall all names be searched or only a selected one?
    If you think that my answer was helpful, please click on the "Add to this user's Reputation" button.

  3. #3
    Registered User
    Join Date
    10-09-2012
    Location
    Wichita, KS
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Match Text from one sheet to another and return text

    All names.

  4. #4
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Match Text from one sheet to another and return text

    Try this in cell F2

    =INDEX(Cohorts!A:B,MATCH(E2,Cohorts!A:A),2)

    Copy formula down
    Last edited by K m; 10-09-2012 at 03:25 PM.
    Click on star (*) below if this helps

  5. #5
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Match Text from one sheet to another and return text

    Sub test()
    
        Dim rng As Range, cell As Range, i As Integer, nname As String
        application.screenupdating = false
        Sheets(1).Activate
        For Each cell In Range("E2", Cells(Rows.Count, 5).End(xlUp))
        
            nname = cell.Value
            Sheets(2).Activate
            Set rng = Cells.Find(nname, after:=Cells(2, 2), searchorder:=xlByRows, lookat:=xlWhole)
            If Not rng Is Nothing Then
                rng.Offset(0, 1).Copy
                Sheets(1).Activate
                cell.Offset(0, 1).PasteSpecial xlPasteValues
            End If
        Next cell
    
    application.screenupdating = true
    End Sub

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,051

    Re: Match Text from one sheet to another and return text

    =vlookup(E2,Cohorts!$A$2:$A$6),2,false)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,051

    Re: Match Text from one sheet to another and return text

    so make up a table with all names, and then apply that formula

  8. #8
    Registered User
    Join Date
    10-19-2012
    Location
    Karachi, Pakistan.
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Match Text from one sheet to another and return text

    Hello!
    How can I count specific word in different rows and in one column

    Thanks
    SMKR

+ 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