+ Reply to Thread
Results 1 to 5 of 5

Possible? Raw # Graph data w/ % labels??

Hybrid View

  1. #1
    Registered User
    Join Date
    11-29-2010
    Location
    University Park, IL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Possible? Raw # Graph data w/ % labels??

    Greetings!

    I am wondering if this is possible or not- I have a table of raw data that I have made a line and bar graph from...What I would like to do is keep the graphs as they are (with the y-axis based on the actual raw data numbers), but then instead of the data labels reflecting that actual raw number as they currently do, I'd like it to reflect what percentage that raw number represents out of the grand total...clear as mud?

    Any idea if this is possible?

    Thanks so much for the help! I have attached a sample of the data in case that helps!!
    Attached Files Attached Files
    Last edited by jgoins; 04-27-2011 at 09:54 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Possible? Raw # Graph data w/ % labels??

    Try this macro

    Sub Test()
    Dim MyChart As Chart
    For N = 1 To ActiveSheet.ChartObjects.Count
        Set MyChart = ActiveSheet.ChartObjects(N).Chart
        For M = 1 To MyChart.SeriesCollection.Count
            For P = 1 To MyChart.SeriesCollection(M).Points.Count
                MyChart.SeriesCollection(M).Points(P).DataLabel.Text = Int(Cells(M + 1, P + 2) * 100 / Cells(15, P + 2)) & "%"
            Next P
        Next M
    Next N
    End Sub
    Martin

  3. #3
    Registered User
    Join Date
    11-29-2010
    Location
    University Park, IL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Possible? Raw # Graph data w/ % labels??

    Quote Originally Posted by mrice View Post
    Try this macro

    Sub Test()
    Dim MyChart As Chart
    For N = 1 To ActiveSheet.ChartObjects.Count
        Set MyChart = ActiveSheet.ChartObjects(N).Chart
        For M = 1 To MyChart.SeriesCollection.Count
            For P = 1 To MyChart.SeriesCollection(M).Points.Count
                MyChart.SeriesCollection(M).Points(P).DataLabel.Text = Int(Cells(M + 1, P + 2) * 100 / Cells(15, P + 2)) & "%"
            Next P
        Next M
    Next N
    End Sub
    Thanks Martin! I don't know how to make use of that macro code Any way you could dumb down some instructions for me to somehow apply it to the file? Sorry- I have a LOT I am still trying to learn!!

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Possible? Raw # Graph data w/ % labels??

    OK.

    Open up the VBA editor by hitting ALT F11

    Insert a new module by hitting Insert - Module

    Paste the macro into the empty sheet

    Hit ALT F11 to get back to the worksheet.

    Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007.

  5. #5
    Registered User
    Join Date
    11-29-2010
    Location
    University Park, IL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Possible? Raw # Graph data w/ % labels??

    Quote Originally Posted by mrice View Post
    OK.

    Open up the VBA editor by hitting ALT F11

    Insert a new module by hitting Insert - Module

    Paste the macro into the empty sheet

    Hit ALT F11 to get back to the worksheet.

    Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007.
    AMAZING!!! Thank you very much- that did work perfectly. I am very grateful for your instructions and help!!

+ Reply to Thread

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.6.0 RC 1