Sort transaction file into Sales Summary

Rogiv

New Member
Joined
May 9, 2019
Messages
2
Hi everyone, I have a huge file about transaction that has 5 columns (Date, Product Name, Quantity, Price, Total Price), example like below:

Date Product Name Quantity Price Total
2019-01-01 A 2 $100 $200
2019-01-01 B 5 $50 $250
2019-01-01 B 50 $50 $2,500
2019-01-01 C 3 $30 $90
2019-02-01 B 1 $50 $50
2019-02-01 B 5 $50 $250
2019-02-01 B 1 $50 $50
2019-02-01 B 10 $50 $500
2019-03-01 C 3 $30 $90
2019-03-01 B 1 $50 $50

My question is, is there a way to sort this file into a total amount sold for every product in every month?

I expect the output will be something like:

Jan Feb Mar Total
A 2 0 0 2
B 55 17 1 73
C 3 0 3 6


Thank you in advance!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
try this


Book1
ABCDEFGHIJK
1DateProductQuantityPriceTotalJanFebMarTotal
201/01/2019A2$100$200A2002
301/01/2019B5$50$250B5517173
401/01/2019B50$50$2,500C3036
501/01/2019C3$30$90
601/02/2019B1$50$50
701/02/2019B5$50$250
801/02/2019B1$50$50
901/02/2019B10$50$500
1001/03/2019C3$30$90
1101/03/2019B1$50$50
Sheet1
Cell Formulas
RangeFormula
H2=SUMPRODUCT(($B$2:$B$11=$G2)*(MONTH($A$2:$A$11)=MONTH("1/"&H$1)),$C$2:$C$11)
 
Last edited:
Upvote 0
with PowerQuery

DateProductQuantityPriceTotalProductJanuaryFebruaryMarchTotal
01/01/2019​
A
2​
$100$200A
2​
0​
0​
2​
01/01/2019​
B
5​
$50$250B
55​
17​
1​
73​
01/01/2019​
B
50​
$50$2,500C
3​
0​
3​
6​
01/01/2019​
C
3​
$30$90
01/02/2019​
B
1​
$50$50
01/02/2019​
B
5​
$50$250
01/02/2019​
B
1​
$50$50
01/02/2019​
B
10​
$50$500
01/03/2019​
C
3​
$30$90
01/03/2019​
B
1​
$50$50

Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    RC = Table.RemoveColumns(Source,{"Price", "Total"}),
    Month = Table.TransformColumns(RC, {{"Date", each Date.MonthName(_), type text}}),
    Pivot = Table.Pivot(Month, List.Distinct(Month[Date]), "Date", "Quantity", List.Sum),
    TotalRows = Table.AddColumn(Pivot, "Total", each List.Sum({[January], [February], [March]}), type number)
in
    TotalRows[/SIZE]
 
Last edited:
Upvote 0
or simpler version

DateProductQuantityPriceTotalSum of QuantityDate
Jan​
A
2​
$100$200Product
Jan
Feb
Mar
Grand Total
Jan​
B
5​
$50$250A
2​
2​
Jan​
B
50​
$50$2,500B
55​
17​
1​
73​
Jan​
C
3​
$30$90C
3​
3​
6​
Feb​
B
1​
$50$50Grand Total
60
17
4
81
Feb​
B
5​
$50$250
Feb​
B
1​
$50$50
Feb​
B
10​
$50$500
Mar​
C
3​
$30$90
Mar​
B
1​
$50$50

change Date to custom format: mmm then create PivotTable
 
Upvote 0
I finally did a pivot table I think that is the most efficient way. Anyway, thank you!
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,497
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top