+ Reply to Thread
Results 1 to 9 of 9

Line chart with days of week (AXIS) and values (lines) distinguished by months

  1. #1
    Forum Contributor
    Join Date
    01-06-2015
    Location
    london,uk
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2307) 64-bit....Windows 10 Enterprise
    Posts
    118

    Line chart with days of week (AXIS) and values (lines) distinguished by months

    Hi Guys

    I am trying to create a pivot line chart based on the following conditions:

    - Please view my illustration. I assumed it would easier than explaining. This is what i am trying to achieve.


    Please find the file enclosed within.Pivot line chart.xlsxPivot line chart.png
    Last edited by chris1089; 06-10-2015 at 06:01 AM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Line chart with days of week (AXIS) and values (lines) distinguished by months

    Hello,

    I don't think this can be done with a pivot table. You cannot plot the lines with dates on the X axis, because May is AFTER April, but you don't want it to plot that way.

    You need a table with just the day names and then copy and paste (or use formulas) to get the pivot data. You can't group the pivot data by day name either, because each day would appear only once and add up all values for all Mondays, say.

    So, create a helper table and create the chart from that helper table.

    2015-06-10_22-34-39.gif

    cheers, teylyn

  3. #3
    Forum Contributor
    Join Date
    01-06-2015
    Location
    london,uk
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2307) 64-bit....Windows 10 Enterprise
    Posts
    118

    Re: Line chart with days of week (AXIS) and values (lines) distinguished by months

    Very insightful.
    how can I link this to live data coming from a pivot table? I need to be able to refresh the helper table without pasting the raw data. Another issue which has been addressed in the response above is that some months start at Tuesdays while others Wednesdays etc. How can i have a calendar type line graph much like the one shown below. Essentially what i am trying to do is use the first Tuesday in may corresponds with the first Tuesday in June when comparing the trend lines.

    : 2015-06-10_22-34-39.gif
    Last edited by chris1089; 06-10-2015 at 12:20 PM.

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Line chart with days of week (AXIS) and values (lines) distinguished by months

    Your data in Sheet 1 does not make sense. Why is the month name in column E different from the actual date in column A? Is that on purpose or is that a mistake?

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Line chart with days of week (AXIS) and values (lines) distinguished by months

    Please see the attached file for a formula solution to prepare the data for charting.

    Since your data does not have more than one value per day, you don't really need a pivot table. I have worked with the source data on Sheet1 instead.

    I have changed the month names in column E to match with the dates in column A. I have added a helper table for the chart, starting in column H.

    Column headers in row 2 contain the start dates for each month. Cell I2 contains a hard-coded date, the cells to the right use a formula to increment by one month. If you want the chart to start with a different month, just change the start date in cell I2. Make sure you enter a date with the first of the month.

    Column H has the weekday names. The formula that starts in cell I3 and is copied across and down uses the number calculated in row 1 to determine if the weekday in column H matches the first of the month, and if so, it starts filling in the data from column C.

    Let me know how that works for you.

    cheers, teylyn
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    01-06-2015
    Location
    london,uk
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2307) 64-bit....Windows 10 Enterprise
    Posts
    118

    Re: Line chart with days of week (AXIS) and values (lines) distinguished by months

    Perfect!!, Final question. How can I ensure that the current month data does not show as zero in the line graph. I want to prevent a straight line moving across at the bottom for data which has yet to be completed due to it being in the current month. Rather it would be better if data just stopped at the most recent day for that month.
    Last edited by chris1089; 06-11-2015 at 11:24 AM.

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Line chart with days of week (AXIS) and values (lines) distinguished by months

    change the formula in cell I3 to

    =IF(I$2+ROW()-(I$1+1)>=EDATE(I$2,1),NA(),IF(ROW()>I$1,IF(INDEX($C:$C,MATCH(I$2,$A:$A,0)+ROW()-(I$1+1))>0,INDEX($C:$C,MATCH(I$2,$A:$A,0)+ROW()-(I$1+1)),NA()),NA()))

    copy across and down.

  8. #8
    Forum Contributor
    Join Date
    01-06-2015
    Location
    london,uk
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2307) 64-bit....Windows 10 Enterprise
    Posts
    118

    Re: Line chart with days of week (AXIS) and values (lines) distinguished by months

    Thanks, the formula seems to change the figures though. Ill try to figure out what the problem is but please have a look

    thanks

  9. #9
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Line chart with days of week (AXIS) and values (lines) distinguished by months

    I used the workbook I attached above, pasted the formula from post 7 into cell I3 and copied down. The numbers did not change. I copied across. No number changed. Just the zeros in the last month got replaced with #N/A.

+ 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] Months and Week Days
    By JakeMann in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-09-2014, 10:52 AM
  2. [SOLVED] How to create line chart in excel having horizontal lines from Y axis
    By pnperl in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 10-16-2012, 01:40 PM
  3. Line chart - different Y axis values?
    By rsd886647 in forum Excel General
    Replies: 3
    Last Post: 03-20-2009, 11:25 AM
  4. [SOLVED] Missing lines in chart w/x-axis with months 1-24...
    By DendWrite in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 05-10-2005, 05:06 PM
  5. [SOLVED] How do I change x axis values in a line chart?
    By Elizabeth in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-29-2005, 06:06 AM

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