Data Label Value in Formula?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to use a data label value in a formula? How would this be done?

Thanks, Phil
 
Phil,

I may not be understanding your question but would a macro like the example
below do? It extracts the text in the first series data label to an variable
of the integer type and then references that variable in a formula in cell
A1. In this example, the formula would look like "= 6 + your label value +
4". Click on your chart to activate it and then run the macro. If it works
for you, it would need to be modified to your specs:

Sub DataLabelTextToFormula()
Dim Cht As Chart
Dim Val As Integer
Set Cht = ActiveChart
Cht.SeriesCollection(1).ApplyDataLabels Type:=xlDataLabelsShowValue
Val = Cht.SeriesCollection(1).Points(1).DataLabel.Text
Worksheets("Sheet1").Range("A1").Formula = "=6+" & Val & "+4"
End Sub

Other than that, you can always direct reference the data source in your
formula as it is the same source for the data label.
 
Back
Top