简体   繁体   中英

Custom graph in excel, x value is always 100% and y is a less than or greater than, showing that percent

I have made a big macro generateing a graph to dynamic data. However, one of my graphs will show actual hours vs estimated. I am using a stacked 100% but the porblem is est vs act can only be possible if est is < actual. I would like to set actual at 100% then have the second data series, estimated, to be either below or aboe that 100% to show 80% or 120% etc.

Thanks so much :)!

ActiveSheet.ChartObjects("Monthly").Delete

For Each ws In Worksheets
 If ws.Name <> "Summary" And ws.Name <> "Calenders" And ws.Name <> "Front Page" And ws.Name <> "Arc" Then
        ws.Range("F129").Copy
        ActiveSheet.Range("BH65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
    End If
Next ws


 For Each ws In Worksheets
 If ws.Name <> "Summary" And ws.Name <> "Calenders" And ws.Name <> "Front Page" And ws.Name <> "Arc" Then
        ws.Range("G128").Copy
        ActiveSheet.Range("BI65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
    End If
Next ws


  Range("BJ2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]-RC[-2]"
Range("BJ2").Select
Selection.AutoFill Destination:=Range("BJ2:BJ75"), Type:=xlFillDefault
Range("BJ2:BJ75").Select

ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlColumnStacked100




ActiveChart.Parent.Name = "Monthly"



ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Values = "=Summary!$BH$2:$BH$53"
ActiveChart.SeriesCollection(1).Name = "=""Estimated"""

Perhaps a stacked bar is not the best type of chart for this problem.

Why not just use a simple column chart plotting the deviation (+/-), like this:

柱状图显示预算偏差

The research nerd in me suggests using stacked bar/column only for ordinal data type :) eg, categories like "< 1 week", "1-2 weeks", "3+ weeks", etc.

Alternatively used a simple stacked bar/column (ie, NOT the stacked 100%), which should allow you to display values like 120%.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM