+ Reply to Thread
Results 1 to 9 of 9

concat cells based on date range

  1. #1
    Registered User
    Join Date
    06-18-2012
    Location
    Bonavista, Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    concat cells based on date range

    i have one column with a bunch of dates and another column with a bunch of values... what I want to do is find all the values that occur on a specific date and concatenate them together in one cell... for example:

    Please Login or Register  to view this content.
    I'm using a UDF so I can concatenate a range for example contact(A:A) or contact(A1:A10)... this works fine but I'm having a hard time figuring out how to select the range based on the date condition... any ideas?

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: concat cells based on date range

    Might give this a try

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Registered User
    Join Date
    06-18-2012
    Location
    Bonavista, Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: concat cells based on date range

    what I need is something I can use in a formula... I don't have much experience with vba but it doesn't look like I can use that in a formula... if you can please post an example.

    in pseudo code basically what I want is:
    Please Login or Register  to view this content.
    obviously the above doesn't work but the idea is that I want to able to use a condition to a find all values in a column that match a date in a corresponding column and then concatenate them together in one cell. I know excel doesn't have native concatenating support when selecting an unknown range so a UDF is at least required to allow the concatenation to work but im just trying to figure out how to combine that with a corresponding date condition.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: concat cells based on date range

    Excel does not have a simple non-VBA range to concatenate a range.

    If you are using a UDF, that means you are using VBA (that's how a UDF works). What do you currently supply to the UDF in order for it to return your concatenated range?

    An uploaded example of your spreadsheet with the UDF would help greatly! (Go Advanced>Manage Attachments)
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Registered User
    Join Date
    06-18-2012
    Location
    Bonavista, Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: concat cells based on date range

    here is the UDF I am working with

    Please Login or Register  to view this content.
    the data is not that complex.... it is sensitive information so I can't upload the actual file but there is only two columns that are effected here for this issue which is the date column and the values column so here is an example of what you might see

    Please Login or Register  to view this content.
    and using the above information this is how I want it to be sorted but the original information left alone and the sorted information in a new sheet. The new sheet will act as a dynamic area where you just change a date and it then back fills the information using the data on sheet1 with the corresponding information.

    Please Login or Register  to view this content.

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: concat cells based on date range

    I couldn't get your UDF to work with my formula so used a UDF from Harlan Grove ACONCAT(range, delimiter) and that seemed to work.
    Add this code to a module for the UDF
    Please Login or Register  to view this content.
    Then use this formula in F2 dragged down.

    =SUBSTITUTE((ACONCAT(IF($A$2:$A$14=E2,$B$2:$B$14,),", "))&", ","0, ","")

    It's an array formula so you need to enter it with CONTRL SHFT ENTER instead of a simple ENTER (that'll put the {} around it if done properly)

    I'm having trouble removing the last comma for some reason. Maybe someone else can figure that out. If it's important, put the formula inside LEFT(the formula, LEN(the formula)-1
    Attached Files Attached Files

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: concat cells based on date range

    Please Login or Register  to view this content.
    Note that the formula in E2 is array-entered.

    Please Login or Register  to view this content.
    Last edited by shg; 09-14-2012 at 11:20 AM.
    Entia non sunt multiplicanda sine necessitate

  8. #8
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: concat cells based on date range

    DaminWarS,

    Attached is an example workbook based on the criteria you described.
    I used a UDF I created named ConcatAll found here: ConcatAll UDF

    In the example workbook there are two types of formulas. In cell E4 and copied down is this regular formula:
    Please Login or Register  to view this content.
    That is a bit long though, and is a lot of work to avoid using an array formula, which is the other option. In cell H4 and copied down is this array formula. Note that array formulas must be entered with Ctrl+Shift+Enter and not just Enter. That's how it gets surrounded by the curly braces {}. Do not try to add those yourself.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  9. #9
    Registered User
    Join Date
    06-18-2012
    Location
    Bonavista, Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: concat cells based on date range

    cool... thanks for all your help all the formulas submitted worked so thanks again!

+ 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