Need totals for each customer, data has duplicates for different jobs

TessaJ

New Member
Joined
Dec 16, 2021
Messages
4
Office Version
  1. 2010
Platform
  1. Windows
I have a data set that has duplicate customers as the original data pulled was based on each month. I'm needing to create a list of each customer with each job/invoice number, job profit. Is there a way to have excel format that instead of going through 1500 lines of data and doing it manually? See sample below. Any help is greatly appreciated!

CustomerDateJob NumberTotal SaleJob Profit
Customer 1
1/28/21​
NO GO
6465​
5600.70
1/28/2133916$9,423.533058.60
Total$15,888.53
Customer 2
1/15/2133497$2,600.002600.00
Total
2600​
Customer 3
1/26/21​
33645$995.00-192.47
1/27/21​
33789
2275​
1013.32
Total
3270​
Customer 4
1/21/2133519$18,873.8518873.85
1/21/2133519$28,507.0528507.05
Total
47380.9​
Customer 5
1/20/2133796$3,575.001337.51
1/20/2133796$3,325.001025.01
1/20/21​
33796$1,295.00149.92
Total
8195​
Customer 6
1/7/21​
33357
1961​
1961.00
1/8/21​
33329
426​
426.00
1/15/21​
33493
4335​
4335.00
1/27/21​
33718
4175​
1430.94
1/27/21​
33718
4175​
1982.19
1/28/21​
NO GONo Go0.00
Total
15072​
Customer 1
1/28/21​
NO GO
6465​
5600.70
1/28/2133916$9,423.533058.60
Total$15,888.53
Customer 2
1/15/2133497$2,600.002600.00
Customer 5
1/20/2133796$3,575.001337.51
1/20/2133796$3,325.001025.01
1/20/21​
33796$1,295.00149.92
Total
8195​
Customer 6
1/7/21​
33357
1961​
1961.00
1/8/21​
33329
426​
426.00
1/15/21​
33493
4335​
4335.00
1/27/21​
33718
4175​
1430.94
1/27/21​
33718
4175​
1982.19
1/28/21​
NO GO
0​
0.00
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
If this is what your expected results should look like then the following Mcode provides this. This is a Power Query Solution
Book14
HIJ
1CustomerJob NumberTotal Profit
2Customer 1NO GO11201.4
3Customer 1339166117.2
4Customer 2334975200
5Customer 333645-192.47
6Customer 3337891013.32
7Customer 43351947380.9
8Customer 5337965024.88
9Customer 6333573922
10Customer 633329852
11Customer 6334938670
12Customer 6337186826.26
13Customer 6NO GO0
Sheet2


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Filled Down" = Table.FillDown(Source,{"Customer"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Customer] <> null)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Date"}),
    #"Filtered Rows1" = Table.SelectRows(#"Removed Columns", each ([Total Sale] <> null and [Total Sale] <> "Total")),
    #"Removed Columns1" = Table.RemoveColumns(#"Filtered Rows1",{"Column1", "Total Sale"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns1", {"Customer", "Job Number"}, {{"Total Profit", each List.Sum([Job Profit]), type number}})
in
    #"Grouped Rows"

Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.

 
Upvote 0

Forum statistics

Threads
1,214,667
Messages
6,120,815
Members
448,990
Latest member
rohitsomani

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