ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Data Label Value in Formula? (https://www.excelbanter.com/charts-charting-excel/261-data-label-value-formula.html)

Phil Hageman

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

Thanks, Phil

Frank Kabel

Hi
it is. But maybe give some more details what you're trying to achieve
exactly

--
Regards
Frank Kabel
Frankfurt, Germany
"Phil Hageman" schrieb im
Newsbeitrag ...
Is it possible to use a data label value in a formula? How would this be
done?

Thanks, Phil




John Mansfield

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.

----
Regards,
John Mansfield
http://www.pdbook.com


"Phil Hageman" wrote:

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

Thanks, Phil



All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com