+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    10-18-2004
    Posts
    3

    Adding a horizontal line to a chart

    Hi All,

    I've recently read various articles on Adding a horizontal line to a chart. However, my chosen method (that avoids the charted threshold values appearing on the worksheet) provided in an article by Tushar Mehta MVP is proving somewhat problematic for me.

    In Tushar's working example the X axis numerical data corresponded to the actual respective Row number - eg:

    http://www.tushar-mehta.com/excel/ch...traight_lines/
    X axis
    Row4 4
    Row5 5
    Row6 6
    Row7 7
    Row8 8

    However, My X-axis data (numbers) does not correspond to its exact same Row number as in Tushar's example data. Is there an alternative formula or a slight variation I can use to utilise the suggested method to avoid the charted threshold values appearing on the worksheet?

    My X-axis and Y-axis data is in Columns A and B respectively and starts from ROW 432 to ROW 492.

    X Y
    ROW432 1 85
    ROW433 2 52
    ROW434 3 95
    ROW435 4 69
    ROW436 5 57
    ROW437 6 71
    ROW438 7 70
    ROW439 8 60
    ROW440 9 90
    ROW441 10 101
    ROW442 11 67 etc.

    I've tried various syntax variations with INDIRECT and INDEX but to no avail.

    Below is an extract of Tushar's formula:
    aRng=sheet1!$C$4:$D$18
    meanLine=AVERAGE(OFFSET(aRng,0,1))*ROW(aRng)/ROW(aRng)

    How does the meanLine named formula work?
    (a) OFFSET(aRng, 0,1) selects the 2nd column of data, i.e., the y-values.
    (b) AVERAGE(...) gives the average of y-values.
    (c) ROW(aRng)/ROW(aRng) creates an array of ones. The array has as many data points as in the original data.
    Multiplying (b) by (d) replaces the ones in the array by the average value.


    Is a variation of the formula possible to work with X axis numerical data that does not match/ correspond to its identical Row number?

    Much appreciated.

    Kind regards,
    Tinä

  2. #2
    Registered User
    Join Date
    09-13-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Adding a horizontal line to a chart

    Here is an alternate approach:

    http://www.exceldashboardtemplates.com/?p=572


    Steve=True

  3. #3
    Forum Moderator teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    2003 & 2010
    Posts
    10,042

    Re: Adding a horizontal line to a chart

    Steve, that thread is 6 years old. I doubt the user will return to read that now.
    teylyn
    Microsoft MVP - Excel
    At Excelforum, you can say "Thank you!" by clicking the icon below the post.

    Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.

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.2.0