+ Reply to Thread
Results 1 to 6 of 6

Combine selected dates into a single string for those with similar month

  1. #1
    Registered User
    Join Date
    11-08-2013
    Location
    Sacramento, California
    MS-Off Ver
    Excel 2010
    Posts
    25

    Combine selected dates into a single string for those with similar month

    Hi everyone,

    I have up to 8 cells in which dates can be selected. I would like the dates that are given to be displayed in another cell and combined if they are of the same month. For example if you pick 12/5 and 12/6 and 12/7 then I want it to display "December 5, 6 and 7" but if 12/5 and12/6 and 1/4 are selected I want it to give "December 5 and 6 and January 4".

    I've got it working for 2 dates, but obviously the hard part is getting it to deal with up to 8. Here is my solution for just two though:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I was wondering if an array constant would be needed??

    Thanks so much!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,421

    Re: Combine selected dates into a single string for those with similar month

    Those TEXT functions will give you month and day, rather than "December 5, 6 and 7".

    You might like to check out this UDF by tigeravatar in the Tips and Tutorials section:

    http://www.excelforum.com/tips-and-t...geravatar.html

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    11-08-2013
    Location
    Sacramento, California
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Combine selected dates into a single string for those with similar month

    Hi Pete,

    Thanks for the link. That function looks useful, but I am needing this to selectively place the dates behind their particular month in the string. So if I have output "December 1 and 2 and January 5", but then change one of the dates to 1/7 then the string will read" December 1 and January 5 and 7". I was just using the Text"MMMM" format to match the months logically, I just as easily used the Month() function to do it however Text is useful for formatting the output. I was not wanting to write a VBA procedure for this as I think I would have to load the months in to a variant array and check all permutations.

    Thanks,

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,421

    Re: Combine selected dates into a single string for those with similar month

    In Post #10 of that thread, Tony Valko refers to using the UDF within an array formula - that's what I thought would be useful to you.

    Pete

  5. #5
    Registered User
    Join Date
    11-08-2013
    Location
    Sacramento, California
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Combine selected dates into a single string for those with similar month

    Ah, I see now.

    Yes, that might very well do what I wanted, thank you for pointing that out. I will see if I can build it.

    Much appreciated,

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Combine selected dates into a single string for those with similar month

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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: 3
    Last Post: 05-09-2013, 10:13 AM
  2. [SOLVED] Sum a selected month's data across a range of dates
    By rooboyz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-08-2012, 11:29 PM
  3. Macro to fill dates as per the selected month in the cell A1
    By kishoremcp in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-04-2012, 03:30 AM
  4. Replies: 2
    Last Post: 08-28-2008, 06:06 PM
  5. Populate dates by selected month
    By cggamer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2007, 01:03 PM

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