How to automatically label data point at intersection of plot?

NotAGenius

New Member
Joined
Jul 19, 2017
Messages
3
Hey Everyone!

I currently have a loop running in VBA that requires inputs from a user, and then provides data and a plot. Essentially this is a break even function. The plot consists of 3 horizontal lines (will be the same in every plot) , and a linear function (changes based on user input). I am trying to have the intersection data points of each horizontal line and the linear function display automatically. Is this possible? If so, how would I go about doing this?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi
Welcome to the board

Get the equations of the lines and solve for the intersections.

The horizontal lines you already have.

You just have to calculate the equation of the linear function, also a straight line, and intersect it with the 3 horizontal ones.
 
Upvote 0
Okay I was thinking that as well. Right now I am thinking about running a loop that exits after the intersection and data label is plotted. Is this correct or is there an easier way? I don't want more than one data label, only one at the intersection!

Hi
Welcome to the board

Get the equations of the lines and solve for the intersections.

The horizontal lines you already have.

You just have to calculate the equation of the linear function, also a straight line, and intersect it with the 3 horizontal ones.
 
Upvote 0
Hi

I was thinking another way, ...

but let me tell you how I understood your problem (that may be wrong)

You have plotted some points in a chart, added a linear trendline and want to know the intersections of the trendline to the 3 default horizontal lines that you have.

If I understood correctly then what I would do is to get the equation of the linear trendline and intersect it directly.

For ex., let's say that the equation of the linear trendline is

Y = 2 X + 3

and one of the the horizontal lines is

Y = 7

Then solving

7 = 2 X + 3

X = 2

This means that the intersection point is (2, 7)
 
Last edited:
Upvote 0
Thanks for that. Unfortunately it isn't as simple as that.
I have a function that runs a loop based off user inputs and then generates a plot. There are 3 intersections with the 3 standard lines. The problem is I want to automatically generate data labels for the intersection points. The above solution will not work because I have to go through after the plot generates and then find the trendline and solve for x.
 
Upvote 0
Find the X and Y values of each intersection point.

Plot each as a new XY series in your chart, and apply a label to each single-point series.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

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