Tooltip is a message or note that appears when the mouse pointer rests on an icon or any graphical interface. In Microsoft Excel, you can put a chart tooltip on the cell. Whenever you hover the mouse pointer over the selected cell, the animation of that chart appears to you as a tooltip. Quite interesting, right? Want to learn how to do this stuff? We will show you the step-by-step procedure to create a tooltip in the Excel chart in this article. So, let’s get started.
Download Practice Workbook
Download the following practice workbook. It will help you to realize the topic more clearly.
6 Steps to Create Tooltip in Excel Chart
For creating the tooltip in Excel, you need to make a dataset first. With that dataset, we need to insert a chart. Here, we have taken a dataset of Area-wise Sales Reports for 6 months.
Not to mention, we have used the Microsoft 365 version. You may use any other version at your convenience.
Step 1: Input Raw Data
- Initially, we put the raw data for creating the dynamic chart. We take the Area and Sales for 6 months and leave them blank.
- Secondly, we create a serial number for the Month column (see the image).
- Eventually, after creating the serial number, we have to use the VLOOKUP function to look for the desired value from the above dataset. So, go to cell C11 to insert the formula.
=VLOOKUP($B$11,$B$4:$H$7,C$9,0)
Here, the function takes the lookup_value for cell $B$11 and searches for it in the table_array of $B$4:$H$7. We set the col_index_num to cell C$9 and range_lookup to 0.
Basically, we have used the function because when we insert the Area in cell B11, it will take all the corresponding Sales values accordingly.
As you can see the Sales value of Florida has been added. You can change the Area in B11, and the values will be changed momentarily for the VLOOKUP function.
Read More: How to Create Dynamic Tooltip in Excel (3 Simple Methods)
Step 2: Create a Chart
- Now, we create a chart with the dataset that is generated by the VLOOKUP function.
- Firstly, select the entire dataset from B10:H11 and navigate to the Insert tab>> choose Insert Column or Bar Chart>> pick Clustered Column.
- Insert the Axis Titles and pick a suitable chart from Chart Styles to give your chart an eye-catching look. You can also follow our chart for better visualization.
- At this moment, select the chart cells and pick the Merge & Center command in the Alignment section from the Home tab.
Read More: How to Add Cell Tooltip in Excel (3 Easy Methods)
Step 3: Paste Chart as Linked Picture
- Now, select the merged cells where we insert the picture of the chart and copy it with the CTRL + C key.
- Consequently, move to another sheet where you want to put the tooltip. Hover over the Home tab>> select Paste dropdown in the Clipboard group>> pick the Linked Picture option.
Your picture will be linked. Now, in the Name box, type “Tooltip” for the image name.
Read More: How to Display Tooltip on Mouseover Using VBA in Excel
Step 4: Add Labels
- Subsequently, in the Developer tab, choose the Insert dropdown in the Controls section>> pick up Label.
The Area and Sales are labeled as shown in the image below.
Copy Label 1 and paste it to the other cells as well.
Read More: How to Add Tooltip to UDF in Excel
Step 5: Customize Labels
- Now, we want to customize our Labels. Select any Label and go to the Properties in the Controls section of the Developer tab.
- A window named Florida Label appears. Change the Name to Florida. Make the BackStyle Transparent and leave the Caption blank.
After doing all the tasks we mentioned above, you will get the image below.
Similarly, apply the same procedure for other Labels and get the image below.
Read More: How to Edit Tooltip in Excel (2 Easy Methods)
Step 6: Employ VBA Code
- Firstly, you need to go back from the Design Mode of Controls ribbon group before initializing the VBA code.
- Moreover, navigate to the Developer tab >> choose Visual Basic.
- Consequently, a window appears. Choose the Insert tab >> Module >> Module 1.
- Write the VBA code in Module 1. You can just double-click on the Labels to move to Module 1 also.
Private Sub Florida_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Sheets("Sheet1").Range("B11").Value = "Florida"
Sheets("Sheet2").Shapes("Tooltip").Left = Sheets("Sheet2").Range("D5").Left
Sheets("Sheet2").Shapes("Tooltip").Top = Sheets("Sheet2").Range("D5").Top
Sheets("Sheet2").Shapes("Tooltip").Visible = True
End Sub
Private Sub Arizona_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Sheets("Sheet1").Range("B11").Value = "Arizona"
Sheets("Sheet2").Shapes("Tooltip").Left = Sheets("Sheet2").Range("D6").Left
Sheets("Sheet2").Shapes("Tooltip").Top =Sheets("Sheet2").Range("D6").Top
Sheets("Sheet2").Shapes("Tooltip").Visible = True
End Sub
Private Sub Chicago_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Sheets("Sheet1").Range("B11").Value = "Chicago"
Sheets("Sheet2").Shapes("Tooltip").Left = Sheets("Sheet2").Range("D7").Left
Sheets("Sheet2").Shapes("Tooltip").Top = Sheets("Sheet2").Range("D7").Top
Sheets("Sheet2").Shapes("Tooltip").Visible = True
End Sub
Private Sub Overall_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Sheets("Sheet2").Shapes("Tooltip").Visible = False
End Sub
You may wonder how big the entire code is! Actually, we have four portions in the code. The first three portions are the same, excluding the Area name. Copy the first portion and paste it for the other two areas. Now, it’s time to explore how the code works.
Code Breakdown
- Initially, we have used the MouseMove event, so we can move the mouse over the Labels, and the chart appears.
- Sheets(“Sheet1”).Range(“B11”).Value = “Florida” command represents that we take the Sheet1 and the value range is cell B11 which is Florida.
- Sheets(“Sheet2”).Shapes(“Tooltip”).Left = Sheets(“Sheet2”).Range(“D5”).Left command implies cell D5 where to show the shape Tooltips we named before for the chart image. Here, we have used the Shapes object which returns any particular shape from your collection. That means it will show the Tooltip image in cell D5 of Sheet 2. We also put the Left command for the left side of the image. Sheets(“Sheet2”).Shapes(“Tooltip”).Top = Sheets(“Sheet2”).Range(“D5”).Top command indicates the top side of the image that will show in cell D5.
- Sheets(“Sheet2”).Shapes(“Tooltip”).Visible = True, in this section we make the Visible command True. That means the image will be shown in Sheet 2.
- Lastly, Sheets(“Sheet2”).Shapes(“Tooltip”).Visible = False means it will not show the image for the overall cells except our desired cells when we hover over the mouse.
Finally, after running the code with the F5 key, go to Sheet 2 and hover the mouse over the Area.
For your convenience, we have added a GIF to help you understand how the tooltip works.
Practice Section
We have provided a practice section on each sheet on the right side for your practice. Please do it by yourself.
Conclusion
That’s all about today’s session. And these are some easy steps to create a tooltip in an Excel chart. Please let us know in the comments section if you have any questions or suggestions. For a better understanding, please download the practice sheet. Visit our website Exceldemy, a one-stop Excel solution provider, to find out about diverse kinds of Excel methods. Thanks for your patience in reading this article.