+ Reply to Thread
Results 1 to 19 of 19

Dynamic Chart with Horizontal Table

  1. #1
    Forum Contributor
    Join Date
    08-07-2008
    Location
    Australia
    Posts
    132

    Dynamic Chart with Horizontal Table

    Hi All,

    I've found great explanations regarding Dynamic Charts (e.g. http://www.contextures.com/xlNames02.html or http://peltiertech.com/Excel/Charts/...hartLinks.html) however all examples refer to data within a table than extends vertically.

    I however would like to creat a dynamic chart on a table with data going horizontally. I assume you have to alter the OFFSET formula to Count for the data going horizontally, but not sure how to do this?? For example, please refer to attached Chart sample in 'Sheet 1'.

    Does anyone know how to kick start me on this??

    Is it also possible to automatically collapse the x range on graph (e.g. data in attached only appears till July, so would like to only show chart till July, rather than Dec. However august data is entered, the chart would extend to show aug)

    Regards
    Tim
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431
    You just need to swap the rows and columns parts of the formula.

    Chart labels named range would be

    CHTLABEL: =OFFSET(Sheet1!$B$22,0,0,1,COUNTA(Sheet1!$B$23:$M$23))

    Data named ranges would be

    CHTDATA1: =OFFSET(ChtLabel,1,0)
    CHTDATA2: =OFFSET(ChtLabel,2,0)

    with the 2 data series having the formula

    =SERIES(Sheet1!$A$23,'climate data4.xls'!ChtLabel,'climate data4.xls'!ChtData1,1)

    =SERIES(Sheet1!$A$24,'climate data4.xls'!ChtLabel,'climate data4.xls'!ChtData2,2)
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    08-07-2008
    Location
    Australia
    Posts
    132
    Hi Andy,

    Thanks for your response, it works great, when I have no content in the data table.

    However, I've attached a different version, where you'll notice the data table has a Vlookup function in the empty cells. For some reason it doesn't work with the Vlookup.

    Do you know a way around this?

    Thanks
    Tim
    Attached Files Attached Files

  4. #4
    Forum Contributor ptm0412's Avatar
    Join Date
    04-16-2008
    Location
    Vietnam
    MS-Off Ver
    Office 2003 and 2007
    Posts
    129
    In this case, I think you should use CountIf instead of CountA in your defined Name ChtLabel:
    =OFFSET(Sheet1!$B$22,0,0,1,COUNTIF(Sheet1!$B$23:$M$23,">0"))
    Because your blank cells is not empty, it has a formula, and the formula returned "" in case Lookup Failed.
    Oldman Chatting: [email protected] Mailing: [email protected]

  5. #5
    Forum Contributor
    Join Date
    08-07-2008
    Location
    Australia
    Posts
    132
    Thanks ptm0412, the COUNTIF formula did the trick.

    However I have another issue.... I also have "#N/A" that also appears in the data occasionally and this seems to exclude that month from the Count.

    I was thinking I would need to add something like "<>N/A", however I don't know how to add it to the formula:
    =OFFSET(Sheet1!$B$22,0,0,1,COUNTIF(Sheet1!$B$23:$M$23,">=0")

    Do you know how I could fix this one?

    Thanks
    Timarcarze!

  6. #6
    Forum Contributor
    Join Date
    08-07-2008
    Location
    Australia
    Posts
    132
    I've had another attempt, but still not working....

    =OFFSET(Sheet1!$B$64,0,0,1,SUMPRODUCT(--(Sheet1!$B$65:$M$65>=0),--(Sheet1!$B$65:$M$65=#N/A)))

    can anyone help on this?
    Thanks

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431
    Currently your data ranges are based off of the CHTLABEL named range.
    I think you need to change it so the labels and each data series has it's own set of formula.

    What exactly should the chart display when 1 series has more information than the other?

  8. #8
    Forum Contributor
    Join Date
    08-07-2008
    Location
    Australia
    Posts
    132
    Hi Andy,

    I'm not sure I entirely understand your comments.

    Basically, I've changed some of the formulas to display NA(), so the graph skips the months without data, rather than plotting as 0. However, now that I've done this, I think the Countif function is not counting that month and shortening the month range.

    E.g. If I have actual data in months Jan, Feb, Mar, 0 data for Apr, data in May, Jun & July. The countif counts data in 6 mths and then only displays months Jan - Jun (missing the data for July).

    I'd like both series data to be recognised and the series that has most months would be represented on graph. E.g. Series 1 has data plots data Jan-Jul, however Series 2 has 0 data in Apr but data in Jan - Aug. I would like the graph to plot to Aug for Series 2 (missing April) and Series 1 to plot to July (missing Aug).

    Hope you can help. Thanks

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431
    You need to change all 3 named ranges

    CHTLABEL:
    =OFFSET(Sheet1!$B$22,0,0,1,MAX(IF(ISNA(Sheet1!$B$23:$M$24),0,COLUMN(Sheet1!$B$23:$M$24)))-1)

    CHTDATA1:
    =OFFSET(Sheet1!$B$23,0,0,1,MAX(IF(ISNA(Sheet1!$B$23:$M$23),0,COLUMN(Sheet1!$B$23:$M$23)))-1)

    CHTDATA2:
    =OFFSET(Sheet1!$B$24,0,0,1,MAX(IF(ISNA(Sheet1!$B$24:$M$24),0,COLUMN(Sheet1!$B$24:$M$24)))-1)

  10. #10
    Forum Contributor
    Join Date
    08-07-2008
    Location
    Australia
    Posts
    132
    Hi Andy,

    Thanks, that seems to do the trick with #N/A, however it hasn't recognised that the chart only plots the graph with either #N/A or >0. E.g. I think the countif (">0"....but I want it to recognise a second criteria of "=#N/A" as well) function took care of that last time.

    Note in attached updated spreadsheet, the chart (for precipation) does not stop plotting months at Aug.

    Do you know how to fix?

    Cheers
    Tim
    Attached Files Attached Files

  11. #11
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431
    CHTDATA1:
    =OFFSET(Sheet1!$B$23,0,0,1,MAX(IF(ISNA(Sheet1!$B$23:$M$23),0,IF(Sheet1!$B$23:$M$23<>"",COLUMN(Sheet1!$B$23:$M$23),0)))-1)

    CHTDATA2:
    =OFFSET(Sheet1!$B$24,0,0,1,MAX(IF(ISNA(Sheet1!$B$24:$M$24),0,IF(Sheet1!$B$24:$M$24<>"",COLUMN(Sheet1!$B$24:$M$24),0)))-1)

    CHTLABEL:
    =OFFSET(Sheet1!$B$22,0,0,1,MAX(COUNTA(CHTDATA1),COUNTA(CHTDATA2)))

  12. #12
    Forum Contributor
    Join Date
    08-07-2008
    Location
    Australia
    Posts
    132
    Ahhh fantastic Andy, you're a legend at this stuff!

    Cheers
    Timarcarze

  13. #13
    Forum Contributor
    Join Date
    08-07-2008
    Location
    Australia
    Posts
    132
    Here is updated file with Andy's help.

    Cheers
    Timarcarze
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    09-27-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Dynamic Chart with Horizontal Table

    HI
    I am trying to do the similar thing but I dont' have vlookup function nor NA issues. So I used the offset with countif to define the range.
    It works but it also includes additional 4 cells. The additonal cells are adjacent and are all empty. Any suggestions on how to rectify it.
    I know its an old post. Still appreciate your help greatly.

    Thanks,
    Appz

  15. #15
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Dynamic Chart with Horizontal Table

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

  16. #16
    Registered User
    Join Date
    07-19-2012
    Location
    Malang
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Dynamic Chart with Horizontal Table

    Quote Originally Posted by timarcarze View Post
    Ahhh fantastic Andy, you're a legend at this stuff!

    Cheers
    Timarcarze
    Thats very great, But may Mr.Andy can help me too, i just need dynamic horizontal chart with double rows of axis , can u help me please

    thanks before
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    12-29-2008
    Location
    Madrid
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Dynamic Chart with Horizontal Table

    Hi,
    I read this but i cant really follow up here as i never had to dig in so deep in the Excel formulas. :-)
    i learned how to make the charts vertical and it Works but i need them to be horizontal.
    How can i add a 12 month timespan to the chart?

    I added the Excel file where i try to find it out but i am onto it since this morning. (shame on me)

    I hope someone could help me out if posible with details as i really wish to learn that.

    Thanks in advance for the help.

    Sky
    Attached Files Attached Files
    Last edited by Skyshield; 12-20-2012 at 09:38 AM. Reason: Attachment was missing

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

    Re: Dynamic Chart with Horizontal Table

    Skyshield,


    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    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]

  19. #19
    Registered User
    Join Date
    12-29-2008
    Location
    Madrid
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Dynamic Chart with Horizontal Table

    Thanks Arlette,

    I opened a new thread.

    This was not obvious as normally the spanish fórums i use ask alwasy to search for threads and write in them :-)

    Have a nice day.

    Sky

+ 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. Chart & Data Table Range displays
    By kostarica in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-12-2008, 08:05 PM
  2. Get a Perato Chart out of Pivot Table
    By mp16 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-02-2008, 02:07 AM
  3. Dynamic Normalization Chart ?
    By impala096 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 03-28-2008, 03:36 PM
  4. dynamic chart
    By icupat in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-01-2007, 05:50 PM
  5. Going insane!
    By kik in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 01-31-2007, 08:21 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