Linking Chart Text to Cell

VBA learner ITG

Active Member
Joined
Apr 18, 2017
Messages
267
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Good morning Experts,

I was wondering is there a formula or VBA solution to my issue.

If i have a chart with Y and X values on the graph, is there a formula or way of automatically populating a cell with the values.

Example: D29 should be the Y value from chart.
Example: D30 should be the X value from chart.

Sample worksheet below.

[FONT=&quot]Download link [/FONT]
https://zackcarter.wetransfer.com/downloads/0ce4c784a5803247a1c75cd918f386b020171102113508/b840823ddfa3bb18e1472dff76b961aa20171102113508/c8161a
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I know the solution to my issue is a Linest formula.

I have tried so many variations i am now lost in Linest.

[h=3]Linear Trendline[/h]Equation: y = m * x + b
m: =SLOPE(y,x)
b: =INTERCEPT(y,x)
[h=3]Logarithmic Trendline[/h]Equation: y = (c * LN(x)) + b
c: =INDEX(LINEST(y,LN(x)),1)
b: =INDEX(LINEST(y,LN(x)),1,2)
[h=3]Power Trendline[/h]Equation: y=c*x^b
c: =EXP(INDEX(LINEST(LN(y),LN(x),,),1,2))
b: =INDEX(LINEST(LN(y),LN(x),,),1)
[h=3]Exponential Trendline[/h]Equation: y = c *e ^(b * x)
c: =EXP(INDEX(LINEST(LN(y),x),1,2))
b: =INDEX(LINEST(LN(y),x),1)
[h=3]2nd Order Polynomial Trendline[/h]Equation: y = (c2 * x^2) + (c1 * x ^1) + b
c2: =INDEX(LINEST(y,x^{1,2}),1)
C1: =INDEX(LINEST(y,x^{1,2}),1,2)
b = =INDEX(LINEST(y,x^{1,2}),1,3)
[h=3]3rd Order Polynomial Trendline[/h]Equation: y = (c3 * x^3) + (c2 * x^2) + (c1 * x^1) + b
c3: =INDEX(LINEST(y,x^{1,2,3}),1)
c2: =INDEX(LINEST(y,x^{1,2,3}),1,2)
C1: =INDEX(LINEST(y,x^{1,2,3}),1,3)
b: =INDEX(LINEST(y,x^{1,2,3}),1,4)
 
Upvote 0
This is the data you show:

Grand TotalUnit Cost
7,7000.14
20,0000.02
20,0000.02
20,0000.02
20,0000.02
20,0000.02
20,0000.02
20,0000.02
20,0000.02
20,0000.02
20,0000.02
20,0000.02
21,0005.00← Outlier
27,9000.04
28,0000.04
29,0000.02
58,4000.02

<tbody>
</tbody>

You can generate points that fit a trendline using LINEST, yes. But first, you have to determine how well the trendline fits the data.

As you've learned, it's easy to add a trendlines to a chart and display the equation for the trendline. It's just as easy to get an idea of how well the trendline fits the data—have the chart display the R² value. R² will be a value between zero and one. The closer the value is to one, the better the fit to the data. If I remember correctly, R² is the "coefficient of determination." I just call it "are-squared." It's a measure of how far your actual data points are from the trendline.

None of the canned Excel trendlines give a good fit to your data, even when the obvious outlier is tossed out.

Yes, you could calculate a y-value for a known x using the values from LINEST. But the data you showed doesn't produce a trendline where the effort will produce anything worthwhile.

In an analytical chemistry lab, I usually wouldn't calculate y-values from a trendline equation unless the R² was above 0.9 or 0.95. For production plant process data, I've sometimes been happy with an R² of 0.75. The data you posted just doesn't produce a meaningful trendline.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,361
Messages
6,130,180
Members
449,563
Latest member
Suz0718

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