• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

how to add data label automatically

koi

Member
hi all,

i have a question regarding data label, lets just say we have something to be input as line chart in every week and we want to show the latest week value in the line chart,

normally what i do is i select the latest dot in line chart and click add data label, then delete the previous week value.

is there any idea how to make this automatic?

thanks
 
hi all,

i think i found a trick by insert text box then point the text box to a cell, in the cell just put a formula to retrieve latest number.

;)
 
Hello!

I'd like that the data label should be updated automatically when I add new data. For example, I entered data for January 9 (highlighted) and I updated the chart, so I'd like the labels are updated too. How can I do that? Here is the example. Thanks a lot for your help!
 

Attachments

  • grafico.xlsx
    14 KB · Views: 41
Hello Oldchippy, thank you very much for your answer, I thought this was the appropriate place to write because my question is related to data label.

How can Excel add for me data label for the last data automatically when I enter new information and delete the data label from the previous day?

Thanks a lot for your help
 
Hi,

With regard to your question turn your data into a Table, selected your data, go to Insert > Table, then when you add to the table the chart is updated automatically

Doesn't that do it for you? You can also delete a line from the Table for the previous day.
 
Hi Chronot,

Welcome to the forum.. Yes I agree with @oldchippy .. that you should go for new Post and if this post is somehow related to your query.. you can refer a link toi this post..

By the way, in the menawhile.. please take a look.. at the attahcment.. :)

I think VBA work best in this case.. but may be some visulaization guru.. will help you in Non-VBA approach..

Code:
Sub ApplyLatestLabel()
ActiveSheet.Shapes("Gráfico 2").Select
  Dim mySrs As Series
  Dim iPts As Long
  Dim bLabeled As Boolean
  For Each mySrs In ActiveChart.SeriesCollection
  bLabeled = False
  With mySrs
  For iPts = .Points.Count To 1 Step -1
  If bLabeled Then
  On Error Resume Next
  mySrs.Points(iPts).HasDataLabel = False
  On Error GoTo 0
  Else
  On Error Resume Next
  mySrs.Points(iPts).ApplyDataLabels _
  ShowValue:=True
  bLabeled = (Err.Number = 0)
  On Error GoTo 0
  End If
  Next
  End With
  Next
End Sub
 

Attachments

  • grafico.xlsm
    20.4 KB · Views: 90
Is it possible, Debraj, to put the chart in a new worksheet only and the button that updates the label in another worksheet? Thank you very much for your help
 
Back
Top