How do I get a label in a scatter plot instead of "Series 1 Point"?

Monsignor

Board Regular
Joined
May 30, 2011
Messages
158
I've got a scatter plot and when I hover over a point, it says something like:

Series 1 Point "1.03" (1.03, 4.12)
Series 1 Point "2.7" (2.7, 3.06)

I'd prefer for it to say:

Thomas (1.03, 4.12)
Leslie (2.7, 3.06)

I can get the labels onto the chart, the problem is when hovering the mouse, everything shows as "Series 1 Point." All of the names are in my first column, but I can't get the hover window to show them.
 
Last edited:

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,166
It works for me. How is your chart data layed out.

I put the series names in A2:A5
The X-axis values in B1:M1
And the Y-Axis values in B2:M5
A1 is blank

Used A1:M6 as the source data (series in rows) and made an XY Scatter chart

Hovering over any data point showed the Series Name (as seen in A2:A5) and the X,Y value
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,166
Hide columns H:I
Make an Scatter chart with data range G6:K98 and data series in Rows
 

Jon Peltier

MrExcel MVP
Joined
May 14, 2003
Messages
4,726
Those little charttips that appear when you hover over the points are not very flexible. They are not actually labels, by the way. They show series name, point number (the X value), and the X and Y values in parentheses. Yeah, X appears twice.

In order to see the location, you need to set up the chart to have one series per row of the data. Tedious by hand, though possible. Easier with VBA. Here's something quick and dirty I cobbled together.

Code:
Sub ChartOneSeriesPerRow()
  If TypeName(Selection) <> "Range" Then GoTo BadData
  Dim DataRange As Range
  Set DataRange = Selection
  If DataRange.Areas.Count > 1 Then GoTo BadData
  If DataRange.Columns.Count <> 3 Then GoTo BadData

  Dim TheChart As Chart
  Set TheChart = ActiveSheet.Shapes.AddChart2(240, xlXYScatter).Chart
  
  Do While TheChart.SeriesCollection.Count > 0
    TheChart.SeriesCollection(1).Delete
  Loop
  
  Dim DataRow As Long
  For DataRow = 1 To DataRange.Rows.Count
    With TheChart.SeriesCollection.NewSeries
      .Values = DataRange.Cells(DataRow, 3)
      .XValues = DataRange.Cells(DataRow, 2)
      .Name = "=" & DataRange.Cells(DataRow, 1).Address(, , , True)
    End With
  Next
  
  TheChart.HasLegend = False
  
ExitSub:
  Exit Sub
  
BadData:
  MsgBox "Select a range with three columns Name, X, and Y", _
      vbExclamation, "Select Data"
End Sub
 
Last edited:

Forum statistics

Threads
1,081,615
Messages
5,360,037
Members
400,565
Latest member
Tommy O

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top