Making Monthly Sales Pivot Report Using Excel Formulas Only.

Making Monthly Sales Pivot Report Using Excel Formulas Only.
0

Upvotes

Upvote

 Aug 22 2022
2 Comments (2 New)
Closed

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.

DateSRAmount
07/23/2022SR1 $        500.00
08/24/2022SR2 $        750.00
08/25/2022SR3 $    1,000.00
07/26/2022SR1 $        500.00
08/27/2022SR2 $        750.00
08/28/2022SR3 $    1,000.00
07/29/2022SR1 $        500.00
08/30/2022SR2 $        750.00
08/31/2022SR3 $    1,000.00
09/01/2022SR1 $        500.00
09/02/2022SR4 $        750.00
07/03/2022SR3 $    1,000.00
09/04/2022SR1 $        500.00
09/05/2022SR2 $        750.00
09/06/2022SR3 $    1,000.00
06/23/2022SR4 $        100.00
08/12/2022SR1 $    1,000.00
06/22/2022SR2 $    1,500.00

 

And we want to make below pivot report from above sales data.

SR/MonthsSep-2022Aug-2022Jul-2022Jun-2022
SR11000100015000
SR2750225001500
SR31000300010000
SR475000100

 

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. 

 

 

 

=LAMBDA(sumCol,dtCol,strCol,LET(a,TOROW(UNIQUE(SORT(BYROW(FILTER(dtCol,dtCol<>""),LAMBDA(x,EOMONTH(x,0))),1,-1)),1),b,UNIQUE(TOCOL(strCol,1)),c,SUMIFS(sumCol,strCol,b,dtCol,">="&DATE(YEAR(a),MONTH(a),1),dtCol,"<="&a),VSTACK(HSTACK("SR/Months",TEXT(a,"MMM-YYYY")),HSTACK(b,c))))

 

 

 

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.

 

 

 

=PIVOTMONTHS(C2:C200,A2:A200,B2:B200)

 

 

 

Any better suggestion to make it improve is greatly appreciated. You can download attached sample file attached with this post.

Harun24HR_0-1661236290970.png

 

Comments
Community Manager
Status changed to: Closed
 
Community Manager

Thanks for the suggestion!

However, the idea space you have posted in is specifically for ideas for the Microsoft Tech Community website, not for products and services such as Microsoft Excel. Sorry about that.

 

We'd recommend you post this suggestion here instead: https://feedbackportal.microsoft.com/feedback/forum/c23f3b77-f01b-ec11-b6e7-0022481f8472