Forum Discussion
Slicer to create Dynamic Chart Titles
You're nearly there, since you already have the selected categories listed somewhere. The one extra thing you need is a fixed list of all 6, so the formula can work out which ones are missing.
Say the selected categories sit in A4:A9 (for example the row labels of a small PivotTable connected to the slicer, with Grand Totals turned off so the total row isn't counted), and the full list of 6 is typed in D2:D7. Put this in the cell your chart title links to:
=IF(COUNTA(A4:A9)=ROWS(D2:D7),"All Categories",IF(COUNTA(A4:A9)>=4,"All Categories excluding "&TEXTJOIN("+",TRUE,IF(COUNTIF(A4:A9,D2:D7)=0,D2:D7,"")),TEXTJOIN("+",TRUE,A4:A9)))
COUNTIF checks each of the 6 against the selected list, and IF keeps only the ones with no match, which gives you the excluded ones. Change the 4 if you ever want a different cut-off.
We recalculated it in another spreadsheet app, not Excel itself, on 7 selections: A,B,C,D gives All Categories excluding E+F, A,C,D,E,F gives All Categories excluding B, A,C,F gives A+C+F, and all 6 gives All Categories. TEXTJOIN needs Excel 2019 or later. In Excel 2019 confirm the formula with Ctrl+Shift+Enter; in 365 and 2021 plain Enter is enough.
(Drafted with AI assistance; formulas tested before posting.)
VARSDigital WORKED LIKE A CHARM! And I liked that I didn't have to define each channel within the formula itself, but rather reference the category names in a hidden sheet. THANKS SO MUCH! Hope this thread helps another person who is looking for a solution like this.