How to Create Dynamic Tooltip in Excel (with Easy Steps)

Step 1 – Use Formula to Fetch Data from Another Sheet

  • In a new worksheet, create a data table with columns L No and Name. In the first column, input the serial number like 1,2,3, etc. And in the second column, enter names in a random serial from the names of the Dataset worksheet.
  • Create a Tooltip column under Column D. Enter the following formula in cell D5.
=IFERROR(VLOOKUP(C5,Dataset!$B$4:$D$10,{2,3},FALSE),"")

The VLOOKUP function returns the value of the same row from the specified column of the given table, where the value in the leftmost column matches the lookup_value.

  • Use the Fill Handle tool to AutoComplete the output in the remaining cells.

using IFERROR and VLOOKUP functions to fetch data from other sheet

  • Select columns D and E and right-click on the mouse. From the context menu, click on the Hide option to hide these two columns.

hiding extra helper columns


Step 2 – Assign VBA Code

  • Right-click on the sheet name tab and click on View Code on the context menu.

assigning code to a specific sheet in excel

  • Enter the following VBA code.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Dim cell As Range

' Clear existing comments
For Each rng In Me.UsedRange
If Not rng.Comment Is Nothing Then
rng.Comment.Delete
End If
Next rng

If Target.Count > 1 Then Exit Sub
If Target.Column <> 3 Then Exit Sub
If Target.Row < 5 Then Exit Sub

Dim tooltipText As String
tooltipText = "Birth Date: " & Target.Offset(0, 1).Value & _
vbCrLf & "Age: " & Target.Offset(0, 2).Value

Target.AddComment tooltipText ' Add comment with tooltip text
Target.Comment.Shape.TextFrame.AutoSize = True ' Adjust the _
comment box size automatically
End Sub

VBA code to create dynamic tooltip in excel

  • Return to the worksheet. Click on any cell of the Name column and it will show the tooltip with the person’s Birth Date and Age. It is dynamic.

dynamic tooltip working when selecting and hovering the mouse over a cell in excel

 

another proof of dynamic tooltip working in excel


3 Methods to Create Static Tooltip in Excel

Method 1 – Utilize Data Validation Feature to Generate Static Tooltip

Steps:

  • Navigate to the Data tab.
  • Choose Data Tools from the Data Tools group.
  • Click the Data Validation icon.

Utilize Data Validation Feature to Generate Dynamic Tooltip

  • The Data Validation window will open.
  • Go to Input Message.
  • Enter the tooltip title in the Title section.
  • Enter a message in the Input Message box.
  • Press OK.

  • Select cell D4.
  • It will produce the output.

Output of Utilizing Data Validation Feature to Generate Dynamic Tooltip


Method 2 – Create Tooltip Using Excel VBA

Steps:

  • Choose the working sheet as the active sheet.
  • Go to Developer.
  • From the Code group, select Visual Basic.

Create Tooltip Using Excel VBA

  • Click Insert followed by Module to get a Module Box.

  • Enter the formula below.
Sub AddToolTip()
Dim target As Range
Set target = Range("D4")
With target.Validation
      .Delete
      .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, _
          Operator:=xlBetween
      .IgnoreBlank = True
      .InCellDropdown = True
      .InputTitle = "Formula Column"
      .InputMessage = "Please, do not modify the Age column. All of the following cells in this field contain a formula."
      .ShowError = True
  End With
End Sub
  • Press F5 or click Run.

  • Select cell D4.
  • We will get the output as shown below.

Output of Creating Tooltip Using Excel VBA

Read More: How to Display Tooltip on Mouseover Using VBA in Excel


Method 3 – Apply Link Option to Create Static Tooltip

Steps:

  • Select the cell D4..
  • Right-click in D4.
  • The Context bar will pop up.

Apply LInk Option to Create Dynamic Tooltip

  • Choose the Link
  • The Insert Hyperlink window will open.
  • Click the Place in This Document icon from the Link To section.
  • Enter D4 in the Type The Cell Reference box.
  • Go to ScreenTip.

  • The Set Hyperlink ScreenTip window will open.
  • Enter a message in the ScreenTip Text box.
  • Press OK.

  • Go to the Insert Hyperlink window and click OK.

  • Use the Mouse cursor to hover over cell D4.
  • We will get the output as shown below.

Output of Applying LInk Option to Create Dynamic Tooltip


Download Practice Workbook


Related Articles


<< Go Back to Excel Tooltip | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Lutfor Rahman Shimanto
Lutfor Rahman Shimanto

Lutfor Rahman Shimanto, BSc, Information Technology, Jahangirnagar University, Bangladesh, has worked with the ExcelDemy project for over a year. He has written 50+ articles and provided solutions of 100+ comments for ExcelDemy. Currently, he works as an Excel & VBA Developer and provides support and solutions in the ExcelDemy Forum. He has solved 100+ ExcelDemy Forum problems. His work and learning interests are in developing various Excel & VBA and Desktop applications. Outside of work, he enjoys Chess... Read Full Bio

2 Comments
  1. Well, this isn’t a dynamic tooltip, this is a static tooltip, a dynamic tooltip changes depending from other cells. What I was looking for, was a tooltip referencing other cells content.

    • Reply Avatar photo
      Shahriar Abrar Rafid Jul 2, 2023 at 11:22 AM

      Hello NOOB Excel,
      Thanks for your feedback and sorry for the inconvenience. Now, check the article. We’ve updated it according to your input. Look over it and let us know if it works well for you now.

      Regards,
      SHAHRIAR ABRAR RAFID
      Team ExcelDemy

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo