+ Reply to Thread
Results 1 to 7 of 7

Returning filtered data to a new sheet in a multiline cell

  1. #1
    Registered User
    Join Date
    11-09-2012
    Location
    United States
    MS-Off Ver
    Office 16 / 365
    Posts
    14

    Returning filtered data to a new sheet in a multiline cell

    Hi all,

    First of all, thank you for all that you do. Searching these forums and Google is a task at times, but so worth it creating new and improved files.

    Ok, so here it goes. I work in insurance and have a file of preferences and contact information split out by region (e.g. Chicago, Boston, New York City, etc.). Each region is on a separate tab with the Sales Reps' contact info as attached (confidential information removed for this thread). Each cell with the Sales Reps per Sales office is a single cell with multiple lines. So, each cell has carriage returns for each additional Rep. This is the same for the Rep name, Rep email, and Rep number.

    At this time, each contact info is updated individually. I'd like to change this and do so on the master Rep sheet. Issue: Once I do this, I'm looking to run a VBA filter command to filter information based on the master Rep sheet and return the names, email, and #s of Reps in a region/office back into the individual regional cell as a multiline cell. The aim is to have this be dynamic enough where you would only have to change the master sheet and the VBA would update from there (if a button is needed, no worries there).

    I'm hoping this is enough info for anyone who is willing to help. Somewhat difficult to reinvent this document while removing all the confidential data. If you have any questions or need more info for insight, please let me know. Your help is greatly appreciated!
    Attached Images Attached Images
    Last edited by yankeesrus07; 11-17-2016 at 04:21 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Returning filtered data to a new sheet in a multiline cell

    You could use formulas on the sheets that link back to the Master Rep sheet e.g.;

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This concatenates cells A1, B1, and C1 from the Master Rep sheet with carriage returns Char(10) in between. When you change the values on the Master Rep sheet, the formula will automatically update.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    11-09-2012
    Location
    United States
    MS-Off Ver
    Office 16 / 365
    Posts
    14

    Re: Returning filtered data to a new sheet in a multiline cell

    Thanks for the quick response!

    The concatenation would work here, but (there's always a but...) once I add a Rep name that would alphabetically be at the end or beginning, wouldn't the formula not be dynamic enough to catch the new entry?

    So, say I had the following:

    Abe (cell D3)
    Mary (cell D4)
    Phil (cell D5)
    Sue (cell D6)

    and I add in Tim to D7, would I need to manually update the formula in the regional sheet each time? Would there be a way to avoid this? Off the top of my head, an embedded if formula, perhaps, but that could get messy. Could I do this in a VBA for loop so that it can automatically update?

    Thanks again!

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Returning filtered data to a new sheet in a multiline cell

    I'm not volunteering to do this, but yes it could be done in with VBA.

    And formulas could be made to list each rep from a region. If you add a new one, it would show up in the list. It wouldn't be too messy if you're willing to have a column where the row number of the rep is calculated so the concatenate formulas can reference it.

    In either case, an example workbook would be required to illustrate your specific layout. You description doesn't give layout details and no one wants to make a workbook based on your image.

  5. #5
    Registered User
    Join Date
    11-09-2012
    Location
    United States
    MS-Off Ver
    Office 16 / 365
    Posts
    14

    Re: Returning filtered data to a new sheet in a multiline cell

    I guess we can explore the formulas first. Here's a test file I've created. The goal is to be able to use Sales Reps column B to show all Chicago Reps by name/email/phone and transfer that data over to Chicago A3/A4/A5, respectively.

    What type of formula would be able to create the for functionality of a VBA loop? So, I would specify that the formula reference Sales Reps column B and find #10 so that only Chicago reps will be shown. Then the formula would go one-by-one and concatenate with carriage returns after each individual entry that's linked with the #10. Unfortunately, based on prior formatting (not my original design), I'm limited to a single cell to display each of the three values (A3/A4/A5).

    Please let me know if you'd need any additional info or clarification.

    Thank you once again!
    Attached Files Attached Files
    Last edited by yankeesrus07; 11-15-2016 at 01:39 PM.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Returning filtered data to a new sheet in a multiline cell

    Instead, I created a custom User Defined Function (UDF) called ConcatIf. Sort of a VBA and Formula solution.

    Put this formula in a cell to concatenate the names based on the region

    =CONCATIF(RegionRange, CriteriaRegion, RangeToConcatenate)

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-09-2012
    Location
    United States
    MS-Off Ver
    Office 16 / 365
    Posts
    14

    Re: Returning filtered data to a new sheet in a multiline cell

    Worked like a charm! Thank you so much!

+ 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. Replies: 1
    Last Post: 03-12-2015, 01:51 AM
  2. Filter sheet data with ComboBoxes, then Update UserForm with filtered sheet data
    By onmyway in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2015, 05:59 AM
  3. [SOLVED] splitting multiline data of one cell to single lines in four cells
    By freeofcost in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-14-2014, 03:38 AM
  4. Index Match Returning Results for Filtered Out Data
    By hermes980 in forum Excel General
    Replies: 2
    Last Post: 08-27-2014, 12:19 AM
  5. Returning the values of filtered items on another sheet
    By tangcla in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-11-2013, 10:46 PM
  6. Populating userform listbox from sheet cell with multiline text
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-16-2013, 07:44 AM
  7. Excel 2007 : Returning filtered data into new cell
    By haleyt in forum Excel General
    Replies: 1
    Last Post: 05-21-2012, 12:01 PM

Tags for this Thread

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