You don't need complex formulas to summarize thousands of rows when PivotTables can do the heavy lifting for you.
PIVOTBY is great for analysis, but PivotTables still have the edge when formatting needs to adapt to data changes.