I believe that the “1000 Cost” concern is because the labeling is a bit of a cheat. The idea is that the 1000 is the Users, and “under” that are Cost, Lo, and High. I suspect formatting the VLOOKUP header row in the folded data table could alleviate the concern…perhaps use VLOOKUP(…) & “Users” & CHR$(10) & … or something to note the Users but push the Cost over. Or perhaps using other formatting and then placing an explicit “Users” below the horizontal axis as an axis label.
As for implementing this with your data set, really you would need to analyze the folded data table. You must realize that there is no ‘syntax’ to make this happen. The end result (the bar chart) is a very simple, automatic chart with the few, basic features as listed directly above the chart.
Understanding how to prepare the data is the key. The modular arithmetic is just a way to create the 0 0, 0 1, 0 2, 1 0, 1 1, 1 2, … sequence across the top. Along with the 0 1 2 sequence down the left, the numbers are fed into the OFFSET function that then acts like a chess player making adjustable “knight moves” to pick out the data in such a way that the Calc charting system will automatically create the chart you want.
That “way” is first of all to conceptualize the table just as Users (User Counts) across and Ad and Referral down. Now imagine that each cell in this simpler table “goes back into the page” for a total of three cells deep. The “surface” is the Cost, then next back is the Lo, then further back is the Hi. But Calc cannot graph from a rectangular solid, only from a rectangle. So, now splay (fan-out) each of these “deeper” cells left-to-right. This is the purpose of the modular math; the row 0 0 0 1 1 1… ultimately (via OFFSET) picks which Users count (1000, 25000,…) while the “smaller” row below it with 0 1 2 0 1 2 picks the “depth” of the cell being splayed (0 is surface, 1 is next back, 2 is next after that, so Cost, Lo, Hi).
Now, with the data properly displayed so that the data you want stacked together show up in the same unique columns, the stacked bar chart is automatic. The only thing remaining is to create horizontal axis labels that clarify the chart. Here I didn’t quite succeed, evidently, but it boils down to just concatenating values and formatting them to finesse a convincing result. These are the values that create the header row in the folded data table. (This might be done with clustering in Excel–I haven’t tried–but Calc doesn’t have chart clustering).