here is how I approached it given your basic setup. I first inserted a row 22above your chart data and put the following data in d21:f21 and d22:f22
0 5000 50000
4999 50000 99999
Then in cell d3, copied to e3
=IF($B$3="I",SUMPRODUCT((D$2=$C$24:$C$60)*($B$17>=$D$21:$F$21)*($B$17<=$D$22:$F$22)*($D$24:$F$60)),IF($B$3="II",SUMPRODUCT((D$2=$H$24:$H$60)*($B$17>=$I$21:$K$21)*($B$17<=$I$22:$K$22)*($I$24:$K$60)),IF(B3="III",SUMPRODUCT((D$2=$M$24:$M$60)*($B$17>=$N$21:$P$21)*($B$17<=$N$22:$P$22)*($N$24:$P$60)),"No Data for this Chart")))
Bookmarks