Excel & Data

How to Create a Dynamic Chart Title in Excel Based on a Slicer

Building interactive reports in Excel often involves slicers to filter data, but a common challenge arises when your chart titles remain static. This can lead to confusion for your audience, as the title might not reflect the currently filtered data. Imagine presenting a sales report where the chart title reads "Total Sales" even when the slicer is filtering for "North Region." This guide will walk you through creating a dynamic chart title in Excel based on a slicer, ensuring your reports are professional, clear, and fully automated.

Thumbnail for Juno School's Excel Pivot Tables and Pivot Charts course, showing a spreadsheet and chart
Recommended Course on JunoExcel Pivot Tables And Pivot Charts
View Course →

The Goal: From Static to Dynamic Chart Titles

The core problem we're solving is the disconnect between an interactive dashboard and a static chart title. Currently, your chart might display a generic title like "Sales Performance." When you interact with a slicer – say, for 'Country' or 'Product Category' – the data in your chart updates, but the title stays the same. This forces the viewer to constantly check the slicer selection, which can be inefficient and prone to misinterpretation.

Our objective is to transform this. Imagine a scenario where, based on the slicer, your chart's title automatically updates to reflect the selected filter, for instance, changing from "Sales Performance" to "Sales Performance for India" or "Sales Performance for India, USA." This is the exact transformation we're aiming for, making your reports more intuitive, professional, and error-free. As the instructor notes, "on the basis of the slicer our title of the chart also changes," providing immediate clarity to the user.

Step 1: Create a 'Helper' Pivot Table

To capture the dynamic selection from your slicer, we need a small, dedicated "helper" pivot table. This table will serve as an intermediary, allowing Excel to 'read' which items are selected in your slicer.

  1. Start with your data: Ensure your main data source (the one your existing chart and slicer are connected to) is in a proper Excel Table format.
  2. Insert a new Pivot Table: Go to the 'Insert' tab on the Excel ribbon, click 'PivotTable', and choose 'From Table/Range'. Select the same data source you're using for your main report.
  3. Place the Pivot Table: Choose to place this new pivot table on a new worksheet or an existing one, ideally in an out-of-the-way cell where it won't interfere with your main dashboard layout.
  4. Configure the Helper Pivot Table: In the 'PivotTable Fields' pane, drag the field that your slicer is based on (e.g., 'Country', 'Product', 'Region') into the 'Columns' area. Do not add any fields to 'Rows' or 'Values'. This will create a horizontal list of the selected items from your slicer, which is crucial for our next step in making the automatic chart title in Excel work.

Step 2: Use the TEXTJOIN Function to Create the Title String

Now that our helper pivot table can display the selected slicer items, we need a formula to compile these items into a single, readable string that will become our chart title. The TEXTJOIN function is perfect for this.

  1. Choose a cell for your dynamic title: Select any empty cell on your worksheet, preferably close to your helper pivot table or your main chart. This cell will hold the final text for your dynamic title.
  2. Construct the TEXTJOIN formula: In this chosen cell, you'll combine a static prefix with the dynamic output from your helper pivot table. For instance, if your slicer is for 'Country' and your helper pivot table shows selected countries in cells B1:D1, your formula might look like this:
    ="Sales by: " & TEXTJOIN(", ", TRUE, B1:D1)
    Let's break this down:
    • "Sales by: ": This is your static prefix. You can customize this to whatever makes sense for your report (e.g., "Performance for:", "Revenue in:"). As the instructor highlights, "I will write the static value. I'll say sales by and then I need that dynamicity of the title."
    • TEXTJOIN(", ", TRUE, B1:D1): This is the core dynamic part.
      • ", ": This is the delimiter. It will separate each selected item with a comma and a space (e.g., "India, USA, UK").
      • TRUE: This argument tells TEXTJOIN to ignore empty cells, which is important when not all countries are selected.
      • B1:D1: This is the range where your helper pivot table displays the selected items. Adjust this range to match where your helper pivot table's column headers appear. The goal here is to concatenate this entire text, including the selected items, into a single cell, as mentioned in the lesson: "I will use the function as text Join... I want this entire text to be concatenated over here."

This formula will dynamically list the selected items, allowing your excel chart title to change with filter selections.

Step 3: Connect Your Slicer to the Helper Table

The magic happens when your main slicer, which controls your primary chart, also controls this new helper pivot table. This ensures that when you make a selection, the helper table updates, which in turn updates your TEXTJOIN formula.

  1. Select your main slicer: Click on the slicer that you want to control your dynamic chart title.
  2. Access Report Connections: On the Excel ribbon, go to the 'Slicer' tab (which appears when a slicer is selected). In the 'Slicer' group, click on 'Report Connections'.
  3. Connect to the Helper Pivot Table: A dialog box will appear, listing all pivot tables in your workbook. Ensure that your main pivot table (the one feeding your chart) is checked, and then, crucially, check the box for the new helper pivot table you created in Step 1. As demonstrated, "I will just get the slicer, I will just select the slicer. I have this wonderful pane of Report Connection over here... I am just going to connect it to Pivot Table 1."

Now, when you click on items in your slicer, you'll see the helper pivot table update, and consequently, your TEXTJOIN formula cell will also reflect the new selection.

Step 4: Link the Chart Title to Your Formula Cell

This is the final step to make your chart title truly dynamic by linking it directly to the cell containing your TEXTJOIN formula.

  1. Select the chart title: Click on the chart whose title you want to make dynamic. Then, click specifically on the chart title itself. Make sure you've selected the title box, not just the text within it.
  2. Go to the Formula Bar: With the chart title selected, click into the Formula Bar at the top of your Excel window (where you usually type cell formulas).
  3. Link to the formula cell: Type an equals sign (=) in the Formula Bar. Then, navigate to the cell containing your TEXTJOIN formula (from Step 2) and click on it.
  4. Press Enter: Hit the Enter key. Your chart title will now display the text from your formula cell, updating automatically whenever your slicer selection changes. As the instructor illustrates, "I will just go to the formula bar, press equal to, and I will just say equal to over here and just press this slicer, and that's it, my dynamic chart is available now." This effectively allows you to link chart title to cell based on slicer selections.

Putting It All Together

You've now successfully created a fully dynamic chart title! The workflow is elegant: your slicer filters your main chart data and, simultaneously, updates a small helper pivot table. This helper table feeds its selections into a TEXTJOIN formula, which then drives your chart's title. This setup is perfect for creating professional excel dashboard dynamic titles that enhance user experience.

To ensure everything is working as expected, test your slicer. Click various items, clear filters (you'll "have this little clear filter option over here"), and observe how your chart title instantly adapts. This level of automation not only saves time but also significantly improves the clarity and professionalism of your Excel dashboards. For a deeper dive into mastering Excel's powerful features, including pivot tables and advanced chart techniques, consider enrolling in Juno School's free certificate course on Excel Pivot Tables and Pivot Charts. You might also find it useful to explore how to track sales rep performance in Excel for more reporting insights.

Ready to level up your career?

Join 5 lakh+ learners on the Juno app. Certificate courses in Hindi and English.

Get it onGoogle Play
Download on theApp Store