For sales analysis, we need to make pivot report. At a glance we want to see monthly sales of each sales representative (SR). In Microsoft Excel we can do it easily by PIVOT Table. But it is really hard to make this kind of pivot table by Excel formulas. In google-sheet we can easily make it by single QUERY() function. There is no equivalent function to MS-Excel. However, we can make pivot report using new excel array manipulation formulas.
Suppose we have below sales data.
And we want to make below pivot report from above sales data.
So, I have used below formula to make this report.
=LET(a,TOROW(UNIQUE(SORT(BYROW(FILTER(A2:A500,A2:A500<>""),LAMBDA(x,EOMONTH(x,0))),1,-1)),1), b,UNIQUE(TOCOL(B2:B500,1)), c,SUMIFS(C2:C500,B2:B500,b,A2:A500,">="&DATE(YEAR(a),MONTH(a),1),A2:A500,"<="&a), VSTACK(HSTACK("SR/Months",TEXT(a,"MMM-YYYY")),HSTACK(b,c)))
And below is LAMBDA() function to use with name manager.
I have give this lambda formula name PIVOTMONTHS. So, anyone want to use this function in any cell of entire workbook enter below formula to cell.
Any better suggestion to make it improve is greatly appreciated. You can download attached sample file attached with this post.