Graphing Intercept Points

rsiluch

New Member
Joined
Jun 2, 2016
Messages
4
Hi there. What I am trying to do is insert intercepts into my line graph, so that my line graph is more easily readable. The problem I am facing is that my line graph is always changing based on the data that is input. Basically, without going into too much detail, I am creating a calculator that determines the best time to take your pension plan (CPP as I live in Canada). As such, the line graph is a representation of my actuarial table, which changes based on the data that is input. Is there any way I can insert intercept points that follow the changes in the graph to keep the points accurate?

Thanks so much for your help!!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
rsiluch,

If you're comfortable with a vba solution the following might be one approach...

Code:
Sub InterceptPosition()

Dim tcChart As ChartObject
Dim kount As Long
Dim pt As Point

Set tcChart = Sheets(1).ChartObjects(1)
kount = tcChart.Chart.SeriesCollection(1).Points.Count

'''' set the desired point and apply a data label
tcChart.Chart.SeriesCollection(1).HasDataLabels = False ' note: this will clear all data labels
Set pt = tcChart.Chart.SeriesCollection(1).Points(kount - 365)
pt.ApplyDataLabels

'''' align the shape to the data label
With Sheets(1).Shapes(2)
    .Top = 415 ' arbitrary number from top of window
    .Left = pt.DataLabel.Left + tcChart.Left
End With

End Sub

Essentially the macro identifies a specific data label, then aligns a shape to that label. In this example, the .Points(kount - 365) is identifying a data point one year ago. And .Shapes(2) is a vertical line shape.

Good luck!

tonyyy
 
Last edited:
Upvote 0
Thanks for your help! Sadly, I am not too familiar with VBA. I don't have the knowledge that I would need to set that up and run it on my spreadsheet as of yet.

Thanks anyways!
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top