SUM of total billed per client but only once, on first occurrence

KauriV

New Member
Joined
May 24, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hi there,

I am trying to format data for a project that has thousands of clients that are each billed separately for each product every month.

What I am trying to do is make it so that column D shows the total billed (Column B) for client (Column A) during the month/year but only in the row when the client first appears in that month. This way, the sum of Col B and Col D would be equal.

Is this possible?

Here is an example of the desired result:

ClientAmountMonth/YearDesired Result
A5995/2020848
B4995/2020957
C6495/20201218
D4495/2020449
A2495/2020
C5695/2020
B4585/2020
A1246/2021587
D5556/20211187
D6326/2021
A4636/2021
B4446/2021444
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi

Enter the following formula in E2 and copy it down

=IF((COUNTIFS($A$2:A2,A2,$C$2:C2,C2))=1,SUMIFS(B:B,A:A,A2,C:C,C2),"")


My spreadsheet layout is given below.


1621907578707.png



Kind regards

Saba
 
Upvote 0
Solution
. If this presentation works for you, then an alternative solution is to group the data using Power Query

Book6
ABC
1ClientDateSum
2AMay-2020848
3BMay-2020957
4CMay-20201218
5DMay-2020449
6AJune-2021587
7DJune-20211187
8BJune-2021444
Table1


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Client", type text}, {"Amount", Int64.Type}, {"Month/Year", type datetime}}),
    #"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([#"Month/Year"]), Int64.Type),
    #"Inserted Month Name" = Table.AddColumn(#"Inserted Year", "Month Name", each Date.MonthName([#"Month/Year"]), type text),
    #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Inserted Month Name", {{"Year", type text}}, "en-US"),{"Month Name", "Year"},Combiner.CombineTextByDelimiter("-", QuoteStyle.None),"Date"),
    #"Removed Columns" = Table.RemoveColumns(#"Merged Columns",{"Month/Year"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Client", "Date"}, {{"Sum", each List.Sum([Amount]), type nullable number}})
in
    #"Grouped Rows"
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,265
Members
449,219
Latest member
daynle

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