I have used Power Query, called Get and Transform Data in your version of Excel and found on the Data Tab.
I loaded your table into the PQ editor. Data-->Get & Transform Data-->From Table or Range
I then applied the following Mcode
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type datetime}, {"Code", Int64.Type}, {"Amount", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Code"}, {{"Data", each List.Sum([Amount]), type nullable number}})
in
#"Grouped Rows"
I then made a duplicate of the original table in PQ and created a merge of each table to the other (a left outer join)
Here is the Mcode for that next section
let
Source = Table.NestedJoin(Table1, {"Code"}, #"Table1 (2)", {"Code"}, "Table1 (2)", JoinKind.LeftOuter),
#"Filtered Rows" = Table.SelectRows(Source, each ([Data] = 650)),
#"Expanded Table1 (2)" = Table.ExpandTableColumn(#"Filtered Rows", "Table1 (2)", {"Amount"}, {"Amount"})
in
#"Expanded Table1 (2)"
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.
Bookmarks