+ Reply to Thread
Results 1 to 5 of 5

Column chart, one data column of dates: count of month & year

  1. #1
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Column chart, one data column of dates: count of month & year

    Good Afternoon!

    I suspect I am making this much harder than it need be; it's been a while since I dabbled in charting.

    I wish to create a menu selection that when selected creates a column chart on a separate sheet.

    As a note, I do not wish to use a pivot chart; I wish to run an automated sub upon selection from the afore mentioned menu to copy over the data to a new sheet and chart it.

    No problem with creating the menu or running the sub from it, it's the extraction of data that is bugging me.

    The source data is a single column of dates.

    I want the chart to reflect Month-Year across the X and the number of times that that month-year occurred in the column of data on the Y.

    Presently I am copying the column of dates to the chart sheet, extracting the month of each data element (cell) to one column, doing the same for the year to another column, then in yet another column running a "Countifs" for the occurrences for the times each month & year occur in the two columns created for those counts, then creating a column chart on that.

    I highly suspect there is a much more elegant method to do this, but I hardly can think of it. My teen-age daughter's music blaring in the background isn't helping...

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Column chart, one data column of dates: count of month & year

    Could you include a sample workbook with non-sensitive data? That would help a lot with figuring out the issue. In many cases, interactive charting can be accomplished by using named dynamic ranges.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Column chart, one data column of dates: count of month & year

    Thank-you, once again!

    I should have noted that I came upon a solution, but I have been so neck-deep in arguing with Excel over the last several days that I simply forgot.

    What I finally did was instead of attempting to extract a unique set of month/year entries, I found the lowest value in the column ( MIN() ), got the first day of that by getting the last day of the previous month then adding one day to it, then I took the current date, stepped that up to the first day of the next month, then starting with the earliest date I posted to a column cell by cell the date incremented by one month at a time.

    Just seemed to me that with all the complex features in Excel something simple to do something like this would have been available...
    Last edited by brucemc777; 08-10-2016 at 06:04 PM.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Column chart, one data column of dates: count of month & year

    I hope you are using the DATE() function for this. For example to get the first day of the next month from Cell A2:
    =DATE(YEAR(A2),MONTH(A2)+1,1)
    You might want to first do a check on DAY(A2) to see if it isn't already 1.

  5. #5
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    583

    Re: Column chart, one data column of dates: count of month & year

    I am using DateAdd in these computations.

    To get my starting point I run with:
    Please Login or Register  to view this content.
    Where intMinDate is the serial for the minimum ( MIN() ) date value in the range column of dates.

    And for my incremental dates I use:

    Please Login or Register  to view this content.
    Where intMaxDate is the Serial for the date when the code is run.

    That use of CDate was not needed, I threw that in when I was trying to track down a problem and was trying to eliminate possibilities.
    (Forgive the convoluted Range designation in that above loop, my thinking was reeling from too many things of which to keep track!)

+ 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] Count the number of time a month and year occur in a column
    By jh51745 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-17-2015, 09:17 AM
  2. Countif based on the Month and Year of a column of dates
    By Motox in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-20-2015, 12:18 AM
  3. Replies: 2
    Last Post: 12-17-2013, 06:30 AM
  4. Bar Chart - Dates in a column by month/year
    By Dargo72 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 12-10-2012, 03:02 PM
  5. Help with Formulae to return a Month and Year only from a column of dates
    By rick.parry in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2012, 08:52 AM
  6. count no. of dates in a column that falls on certain month & year
    By RawSugar in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-20-2005, 06:05 PM
  7. [SOLVED] Sorting dates:How do I sort a column filled with dates by Month, Day, then Year?
    By Heather in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-22-2005, 10:05 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