+ Reply to Thread
Results 1 to 11 of 11

graph with dates evenly spaced

  1. #1
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    graph with dates evenly spaced

    Hello,

    I have these 2 columns, date DD/MM/YYYY and a numeric value for each day.
    I created this graph, now the issue is that i don't have a numeric value for each day, for example there are gaps of various length: 29/09 and then 21/10 ...
    when i plot it in the graph, i get the dates one next to the other as if they were equally spaced, but i'd like to see in the graph this date gaps in a proportional way: 08-08 -> 09-08 should be 20 times smaller than the distance 29-09 --> 21-10 ... i hope i'm making myself clear.
    the graph is attached. many thanks!

    Screenshot - 3_4_2017 , 10_45_11 AM.png
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,437

    Re: graph with dates evenly spaced

    I note that many of your "date" entries are actually text entries. The first step in getting a real date axis for your chart is to get all of your dates converted to real dates and not text (the DATEVALUE() function should be useful for this https://support.office.com/en-us/art...3-b7471bbff252 ). You may also want to spend some time with a discussion of how Excel stores dates and times as serial numbers: http://www.cpearson.com/Excel/datetime.htm#SerialDates

    That may fix the axis issue by itself, as Excel will usually automatically display an axis based on dates as a date axis. In the event that Excel continues to treat the axis as a category/text axis, you can go into the format axis dialog and specify that this axis should be a date axis.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    Re: graph with dates evenly spaced

    ok but the dates are already converted as date... i'm not sure what else to do?


    Screenshot - 3_5_2017 , 2_32_15 AM.png

  4. #4
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    Re: graph with dates evenly spaced

    I also tried to use the formula =DATEVALUE but i'm getting an error.... first of all i don't understand:

    my dates are formatted as DD-MM-YYYY , while I see the formula =DATEVALUE("8/22/2011") .... so would i have to re write all the dates as DD/MM/YYYY?

    I tried with one, but i'm getting an error.... can you actually upload the xls with the right format using the =DATEVALUE function?
    Screenshot - 3_5_2017 , 2_46_04 AM.png

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,997

    Re: graph with dates evenly spaced

    I hope that this will demonstrate what Mr. Shorty is saying.
    First the values in column A are not all dates. Excel stores dates as the number of days since 1/1/1900. If the value in A2 was the date July 18, 2016 then changing the format from date to number would cause the cell to display 42569. Some of the values are dates, such as A11:A16.
    One way to change the values to dates is to use the Text to Columns function on the Data tab. Select A2:A10; from the data tab run Text to Columns; Next; Next; select date; change drop down to DMY; Finish
    You could continue this way for each contiguous range of text cells however you could also use the following formula, as shown in column C, to convert the text values to dates:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    You can then copy column C and paste it to column A as values only. An example of the outcome is shown on sheet2 of the attached file.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,437

    Re: graph with dates evenly spaced

    Note that number formatting does not change the underlying value of a cell. If you put =ISTEXT(A2) into D2, it will return TRUE. If you copy this formula down, it will indicate which entries are text and which are numbers.

    As noted in the help file, the DATEVALUE() function uses your computer's date system setting to decide how to interpret dates.
    Quote Originally Posted by Excel help
    Remember, though, that your computer's system date setting may cause the results of a DATEVALUE function to vary from this example
    I went into Window's Control Panel -> Regional and Language setting and specified dd-M-yyyy as the system default date setting, and the DATEVALUE() function worked just fine.

    Even for those entries that are dates, did Excel correctly interpret them? I note that the first batch of text dates are in late July, but the first real date is 8 Feb (follow by 8 Mar, 8 Apr, etc.). Were these supposed to be August dates (2 Aug, 3 Aug, 4 Aug, etc)? If this is the case, I would go back to the data entry step and modify the data entry so that Excel will enter these dates correctly from the start, rather than trying to "fix" it after the fact. This will require knowing exactly where this data comes from and how it is getting entered into Excel, and then changing it until Excel will correctly interpret the entry.

    If you must fix this after the fact, you might prefer to use the DATE() function instead, coupled with Excel's text manipulation functions (LEFT(), RIGHT(), MID()) to convert these text strings to dates. As an example, =DATE(RIGHT(A2,4),MID(A2,4,2),LEFT(A2,2)) Seems to work for the A2 -- though it will not work for A17, nor will it work for those that have been converted to the wrong date (if that is indeed the case). For A17, you could use =DATE(RIGHT(A17,4,MID(A17,1),LEFT(A17,2)). To convert those incorrect dates to the correct date, you could use the MONTH(), DAY() and YEAR() functions to get the day, month, and year that Excel erroneously entered for these, then put that into a DATE() function to get the correct dates. Something like =DATE(YEAR(A11),DAY(A11),MONTH(A11)) Will switch the day and month.

    If you are unfamiliar with any of these function: https://support.office.com/en-us/art...1-63f26a86c0eb
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    Re: graph with dates evenly spaced

    Quote Originally Posted by MrShorty View Post
    Thank you, yes i understood and it did work. I have one more step to do. I've re uploaded the spreadsheet with another tab. "sheet2" in this tab there is another series of dates+values ... the value of table1 has no connection to the value of table 2, but i'd like to overlay the data in sheet2 on the graph of sheet1.

    The ranges are different, so i'd like to keep them both in the same graph, and adjust ( logaritmically?) the values on sheet2 so that they can be seen on the graph of sheet1 .... and i'd like to see the values of the Y axes of sheet2 on the right side of the graph of sheet1 ... i hope it makes sense

    Screenshot - 3_5_2017 , 11_47_45 AM.png
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,437

    Re: graph with dates evenly spaced

    I use exclusively scatter charts, so I am not as skilled with these line charts with date axis. If this were a scatter chart, it would be as simple as adding the second data set as a second data series (I usually use the select data dialog, as I find it a more robust method for selecting the desired X and Y value ranges). Then add the secondary Y axis (https://support.office.com/en-us/art...8-e1a2e14dd5a9 ).

    On the rare occasions that I mess with line charts (mostly related to this forum), I find that I need both the secondary vertical and horizontal axes to get the desired effect (the help file above explains how to add both secondary axes to an existing chart). I also find that the only way to add the second data series with its own x-values data is to copy the range, then paste special -> as new series with x values in the first column. Note that you need to have the second series added to the chart before you can add the secondary axis system.

  9. #9
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    Re: graph with dates evenly spaced

    thanks MrShorty,

    i followed the instructions but i wasn't able to add the secondary dataset. The problem is that my secondary dataset (21xx blue) is different to the first dataset , so it first need to
    be adjusted, i guess, to match my existing graph... links to instructions or video wont help, i've already tried a few and they all take for granted that the data to add to an existing graph is formatted
    in the same way already, too easy... could anyone help me directly on the spreadsheet?

    this is the result when i tried to follow the instruction...
    the problem is that the 2 value datasets ( 21xx blue and 43xx yellow ) are on a way different range.. so i need somehow to make them compatible, based
    on the 43xx yellow values. if can someone help me directly on the file, it will be very appreciated,
    many thanks!
    Screenshot - 3_6_2017 , 2_52_49 AM.png
    Last edited by cat3appr; 03-06-2017 at 04:05 AM.

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,997

    Re: graph with dates evenly spaced

    If I understand, you want both sets of data on the same graph, with the same horizontal axis and with separate vertical axes. I attempted to make a graph referencing the data while still on sheet 2, but for some reason the horizontal axis scale wouldn't work, so I ended up copying the data to sheet 1 as in the screenshot of post #9. After adding the second series to the graph I selected the second data series, chose format data series and selected secondary axis. Other than that I chose a solid line color for the second data series and matching font for the secondary axis.
    Let us know if you have any questions.
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,437

    Re: graph with dates evenly spaced

    Then, I took JeteMc's chart, selected the yellow "value2" data series, clicked on the formula bar in the "x_values" section of the SERIES() formula (=SERIES(series_name,Xvalues,Yvalues,series_order), and entered Sheet1!$C$2:$C$118 to get the second series to use column C for its X values.

+ 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. Evenly spaced X Axis not required
    By helga55 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 10-21-2013, 01:52 PM
  2. Format rows so they're evenly spaced
    By fb718 in forum Excel General
    Replies: 11
    Last Post: 06-22-2011, 06:03 PM
  3. How to get graph axis to have evenly spaced values.
    By JamesWMH in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-21-2010, 11:29 AM
  4. [SOLVED] i have to add cells evenly spaced, eg a1 + a11+a21+...+a991
    By mcutlac in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-25-2006, 02:35 PM
  5. Can't get evenly spaced chart x-axis labels
    By tcarp in forum Excel General
    Replies: 3
    Last Post: 04-24-2006, 08:10 PM
  6. [SOLVED] evenly spaced page breaks
    By sorrywm in forum Excel General
    Replies: 2
    Last Post: 12-14-2005, 08:30 PM
  7. [SOLVED] Variable dates on X axis evenly spaced (should not be)
    By Leo Bueno in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-24-2005, 12:05 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