+ Reply to Thread
Results 1 to 16 of 16

populate cell with text from other cell that matches text from adjacent cell

Hybrid View

  1. #1
    Registered User
    Join Date
    11-19-2007
    Posts
    21

    populate cell with text from other cell that matches text from adjacent cell

    on sheet1 Column A has text, which is a list of roles people are assigned. I want Column B to populate with the Name of the person, coming from sheet2.
    on sheet 2 Column A has drop down menu where I can select what role each person will have (their names are in B Column).

    in some cases there are multiple people that have the same role. I was thinking maybe the CONCATENATE function could help with that, some how gather up all the people with the same role, put them together in the same cell, separated by comas.


    This is for a non profit, and will save us so much time! Thank you all very much in advance!

  2. #2
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: populate cell with text from other cell that matches text from adjacent cell

    Like the last line - no need for that - we love to assist and spread the knowledge.

    Now it sounds like you have an intermediate level of knowledge and a clear plan... Would you be able to post a sample of your data...

    Basically on Sheet 2, Insert a column in front of A and put the following column in A2

    =$B2&"-"&Countifs($B$2:$B2,$B2)
    What I am doing here is giving you a Unique lookup value to run based on role selected -

    Now back to sheet 1 you will want to have A2=Role selected and then A3 = A2, A4= A5 and so on so that it reads the same ROLE all the way down A to a max amount that you would expect.

    Now in B2 on sheet 1 you will enter

    =IFERROR(VLookup(A2&"-"&Countifs($A$2:$A2,$A2),Sheet2!$A:$C,3,False),"")
    You will notice that the Vlookup value is the same formula as that in which you put into A on sheet 2 and then we pull from that list based on that value.

    I apologize if any of those are not contained/closed formulas, writing it in here without the actual reference I may have missed something
    -If you think you are done, Start over - ELeGault

  3. #3
    Registered User
    Join Date
    11-19-2007
    Posts
    21

    Re: populate cell with text from other cell that matches text from adjacent cell

    That works wonderfully! One job is "Male Small Group Leader". I have 6 of those. what you did for sheet2 appended the text with a -1, -2, -3 at the end of each one. When i put the formulas in sheet 1, it only lists the one with -1 but does not list the other 5. is there a way to get them to list all of them in one cell? Maybe with a comma between them?

  4. #4
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: populate cell with text from other cell that matches text from adjacent cell

    you want everyone to populate one cell...

    Joe,Chris,Michael,Jamie...etc?

    Can I ask what the end goal is - that will help to anticipate such needs - This is also where a sample workbook comes in as it will allow me or someone else to jump in and see where you are going. Have a mock tab of what you expect the final output to look like and then I or someone else will be able to make that happen...

    There are ways to make this happen, would require further "Helper" columns and/or setup but can be done without VBA as well as with.

  5. #5
    Registered User
    Join Date
    11-19-2007
    Posts
    21

    Re: populate cell with text from other cell that matches text from adjacent cell

    Workshop sample.xlsx

    Here is the file, I think.

  6. #6
    Registered User
    Join Date
    11-19-2007
    Posts
    21

    Re: populate cell with text from other cell that matches text from adjacent cell

    EleGault,
    Thank you very much for the help. I'll uploaded a sample file. I'll talk you through it a bit here: The first tab is "staff". I get the basic data from an Excel file exported from Eventbrite.com data, where people register to help staff (and participate) in the workshop. Column B is where I select their job assignment, which populates the dropdown list (from B69:b88). Column C is where I've concatenated the first/last names to be in one column (so it shows that way on the "Job Sheet".

    Speaking of Job Sheet, that is a sheet I want to be able to print out for the staff of the workshop, so they know who is responsible for what. The most important parts that need to be populated from the "staff" tab are: the leadership positions (shown on the top of the job sheet), the Small Group TAs (broken out by gender, all listed in one cell like you showed in your last post [Matthew, John, Jim, Jake] all in one cell). And the same for the power team. I'd like to have the option to also have the Computer Tech, AV Tech, etc. populate, but that's not super important. the rest of it can be typed in manually, selecting from the names shown on the bottom of the sheet. What this means is that every person staffing the workshop should have their name auto-populated onto the Job sheet.

    The Participant information is also derived from Eventbrite.com. The "CQ" Column is what automatically changes to "Yes" when that participant has completed the confidential questionnaire, and I copy their responses into the "CQ" tab. (I get those responses in a google spreadsheet, from a Google Form.). I've also concatenated the First/Last name into one cell, so that it will match the CQ results which have "full name" in one column. The concatenated results are in column AE of the Participant tab.

    I hope I've not been too verbose, or too unclear. please let me know if i need to clarify anything.

    Thanks,
    Ian

  7. #7
    Valued Forum Contributor
    Join Date
    07-07-2014
    Location
    Washington DC
    MS-Off Ver
    2007
    Posts
    1,047

    Re: populate cell with text from other cell that matches text from adjacent cell

    Here's one method that might work using the UDF =ARLOOKUP. Let me know if this works.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-19-2007
    Posts
    21

    Re: populate cell with text from other cell that matches text from adjacent cell

    it works on the one you attached, but when i copy it to my spreadsheet, it gives me the #Name? error. I double checked to make sure that the formula copied over exactly right, but it still gives me the error. Thoughts? I can't upload the actual file, because it contains lots of confidential personal information for people.

  9. #9
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: populate cell with text from other cell that matches text from adjacent cell

    ARLookup is a function built in that workbook provided by Hoyasaxa215- you need to copy the module or VBA out of it - You get a Name error because that function does not exist in your other workbook

    Public Function ARLOOKUP(SearchRange As Range, SearchVertical As String, SearchHorizontal As String) As Variant
    
    '  This function is create on 02-23-2008 ( February 23, 2008 )
    '  Source : Erik Winters, www.excelguide.eu
    '  © all rights reserved
    
    
    '  The use of this function is free on the next conditions :
    '  - the source keeps stated;
    '  - the code is not used to generate commercial profits;
    
    
    '  For an explanation of this function you might visit www.excelguide.eu
         
        Dim SearchColumn As Variant
        Dim SearchRow As Variant
        Dim ColumnCount As Long
        Dim RowCount As Long
        Dim FindColumn As Long
        Dim FindRow As Long
        Dim HitsCount As Long
         
        ColumnCount = 0
        RowCount = 0
        HitsCount = 0
         
        For Each SearchColumn In SearchRange.Columns
            ColumnCount = ColumnCount + 1
            If VBA.UCase(SearchColumn.Columns.Cells(1, 1).Value) = VBA.UCase(SearchHorizontal) Then
                FindColumn = ColumnCount
            End If
        Next SearchColumn
         
        For Each SearchRow In SearchRange.Rows
            RowCount = RowCount + 1
            If VBA.UCase(SearchRow.Rows.Cells(1, 1).Value) = VBA.UCase(SearchVertical) Then
                FindRow = RowCount
                If FindColumn = 0 Or FindRow = 0 Then
                    ARLOOKUP = 0
                Else
                    HitsCount = HitsCount + 1
                    If HitsCount = 1 Then
                        ARLOOKUP = SearchRange.Cells(FindRow, FindColumn).Value
                    Else
                        ARLOOKUP = ARLOOKUP & ", " & SearchRange.Cells(FindRow, FindColumn).Value
                    End If
                End If
            End If
        
        Next SearchRow
         
    End Function

  10. #10
    Valued Forum Contributor
    Join Date
    07-07-2014
    Location
    Washington DC
    MS-Off Ver
    2007
    Posts
    1,047

    Re: populate cell with text from other cell that matches text from adjacent cell

    Right, as ELeGault properly points out, the UDF won't work in a separate file without manually creating the UDF via the VBA code provided. My previous message noted copying and pasting YOUR data into MY file as a way to bypass this process. Alternatively, you can create the UDF yourself using the code that ELeGault provided. Whatever works for you.

  11. #11
    Registered User
    Join Date
    11-19-2007
    Posts
    21

    Re: populate cell with text from other cell that matches text from adjacent cell

    Thanks again, guys. I copied the module into my workbook, and it works great. the only problem i'm seeing now is that it is intermitant in updating. if I change the assignment someone has (on the "staff" sheet) it doesn't always update on the "Jobs" sheet. any idea why that might be?

  12. #12
    Registered User
    Join Date
    11-19-2007
    Posts
    21

    Re: populate cell with text from other cell that matches text from adjacent cell

    I decided to just use the ARLOOKUP file, and drop the rest of my data into, and it still works. Say, how did you set it up for the drop down filter options to be at the top where the header is? I'd like to apply those settings to the rest of the columns.

  13. #13
    Valued Forum Contributor
    Join Date
    07-07-2014
    Location
    Washington DC
    MS-Off Ver
    2007
    Posts
    1,047

    Re: populate cell with text from other cell that matches text from adjacent cell

    Select the column headings and then click on Data > Filter. Keyboard shortcut is alt+D+F+F.

  14. #14
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: populate cell with text from other cell that matches text from adjacent cell

    Or in newer versions ALT A T in that order (Not at the same time) - Same time would be CTRL+SHIFT+L

    when you hit alt you will see characters show up all over anything you can click..this is how you can learn these combinations. tap the character that takes you to where you know you want to go!

    Basically you are applying a sort and filter which is an icon that looks like a funnel or sift - Make sure the headers/row you want to add this to is highlighted when you do so -

  15. #15
    Valued Forum Contributor
    Join Date
    07-07-2014
    Location
    Washington DC
    MS-Off Ver
    2007
    Posts
    1,047

    Re: populate cell with text from other cell that matches text from adjacent cell

    Quote Originally Posted by ELeGault View Post
    Or in newer versions ALT A T in that order (Not at the same time) - Same time would be CTRL+SHIFT+L

    when you hit alt you will see characters show up all over anything you can click..this is how you can learn these combinations. tap the character that takes you to where you know you want to go!

    Basically you are applying a sort and filter which is an icon that looks like a funnel or sift - Make sure the headers/row you want to add this to is highlighted when you do so -
    Guess I'm aging myself with my keyboard shortcuts...

  16. #16
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: populate cell with text from other cell that matches text from adjacent cell

    Guess I'm aging myself with my keyboard shortcuts...
    haha its just a version difference - and the old shortcuts work - they just wont visually display for one to follow when keying them in -

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copy any bold text within a cell text string to an adjacent cell
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-31-2014, 06:22 PM
  2. Replies: 2
    Last Post: 03-17-2014, 12:14 PM
  3. Formula to identify part of a text in cell from range of cells & insert adjacent cell text
    By Novicebutnotforlong in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-19-2013, 02:11 AM
  4. Populate column if cell's text matches cell in another sheet
    By Rela in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-14-2013, 09:53 AM
  5. Replies: 3
    Last Post: 07-02-2008, 10:15 AM

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