+ Reply to Thread
Results 1 to 9 of 9

list values from multiple cells in one cell separated by linebreaks

  1. #1
    Registered User
    Join Date
    06-28-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010, Excel 2011 for mac
    Posts
    82

    list values from multiple cells in one cell separated by linebreaks

    Hi,

    I would like to list values from an array of cells into one cell separated by a new line

    example
    years are given in column a
    (a1,a2,a3) = (2002, 2004, 2008)

    I would like to show all three years in cell b1. ie
    b1 = a1 (linebreak) a2 (line break) a3

    displayed as
    b1= 2002 (linebreak) 2004 (line break) 2008


    I know I can do this by
    b1 = a1 & CHAR(10) & a2 & CHAR(10) & a3

    But I would like to display the years by giving the start reference and the end reference ie. cell a1:a3

    The reason for this necessity is that the number of years in each cell varies, ie. 3 rows in cell b1, 2 rows in cell b2 etc.

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: list values from multiple cells in one cell separated by linebreaks

    Sorry you lost me. I am guess you want to give the start reference and end reference somewhere and the cell is populated for you. Can you give some worked examples?
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    06-28-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010, Excel 2011 for mac
    Posts
    82

    Re: list values from multiple cells in one cell separated by linebreaks

    Figured that might happen - Lost myself a couple of times explaining.

    Yes thats right, I want to add the start and end point and have excell list the data from that range in one cel.

    I've uploaded a picture showing a simplified version of what I need

    find it here:
    http://tinypic.com/r/jpg2fl/6

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: list values from multiple cells in one cell separated by linebreaks

    Don't think this can be done with a regular formula. Probably a user-defined function. Can you upload a sample wokrbook?

  5. #5
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: list values from multiple cells in one cell separated by linebreaks

    Hi try this
    Please Login or Register  to view this content.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  6. #6
    Registered User
    Join Date
    06-28-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010, Excel 2011 for mac
    Posts
    82

    Re: list values from multiple cells in one cell separated by linebreaks

    Hi Tom,

    Not sure how to go about this. I guess it's for use in Visual Basic?

  7. #7
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: list values from multiple cells in one cell separated by linebreaks

    Yes this is macro It should be pasted in module if You do not know nothing about VBA try to find on google phrase "How to run macro" in your own language because like abousetta said it will be rather hard to do with "normal" formuals
    Last edited by tom1977; 06-06-2012 at 08:15 AM.

  8. #8
    Registered User
    Join Date
    06-28-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010, Excel 2011 for mac
    Posts
    82

    Re: list values from multiple cells in one cell separated by linebreaks

    okay. Thank you. I'll look into that

  9. #9
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: list values from multiple cells in one cell separated by linebreaks

    1) Create a standard vba module (Details on how to)

    2) Copy and paste the code below (modified version of tom's):

    Please Login or Register  to view this content.
    3) In your worksheet, write:

    =MyYears(A1,A10)

    and you are done

+ 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