Generating a Summary that has varying number of entries based

chiron

New Member
Joined
Dec 17, 2012
Messages
28
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Section 1
Item No.DescriptionBudgetTotal InvoiceCurrent Invoice
1AAAA10100
2BBBB1052
3CCCC1000
4DDDD1033
Subtotal40185
Section 2
Item No.DescriptionBudgetTotal InvoiceCurrent Invoice
5E10100
6F1052
7G1000
Subtotal30152

<tbody>
</tbody>


I want to automatically generate a summary that looks like this in a different sheet;

Item No. Current Invoice
22
43
62
Total7

<tbody>
</tbody>

I cannot change the structure of the original table and it has titles repeated as text for each section. What is a good way to do this? The way I am doing it now is to filter and then copy visible cells into the next sheet and total but I think there must be a way to do dynamically generate this table based on the data entered.
 
Last edited:

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
use PowerQuery (Get&Transform)
transform tables into proper tables
append into one table
define which items you want to see (even/odd) and filter it
then load table to the sheet whereever you want

ps.
section1 & section2 pretend to be one "table" or they are single tables?
are they excel tables or ranges ?
the names Section1 and Section2 are included in these tables or are they only used for example
 
Last edited:
Upvote 0
It is a single worksheet with repeating titles and blank rows between sections. Can't change that sheet as its what my company is sticking to. I was thinking along the lines of a macro which will check for non-zero numeric values in the "Current Invoice" column and put the corresponding data into a different sheet, parsing till it gets to the end of the worksheet.

Not familiar with Powerquery. Will look into it.
 
Last edited:
Upvote 0
here is result from your source "as is"

Item No.Current Invoice
2​
2​
4​
3​
6​
2​
Total
7

Code:
[SIZE=1]let
    Source = Excel.Workbook(File.Contents("[I][COLOR="#0000FF"]path to your excel file[/COLOR][/I]"), null, true),
    Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
    #"Filtered Rows" = Table.SelectRows(Sheet1_Sheet, each ([Column5] <> null)),
    #"Promoted Headers" = Table.PromoteHeaders(#"Filtered Rows", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Item No.", type any}, {"Description", type text}, {"Budget", type any}, {"Total Invoice", type any}, {"Current Invoice", type any}}),
    #"Filtered Rows1" = Table.SelectRows(#"Changed Type", each ([#"Item No."] <> null and [#"Item No."] <> "Item No.") and ([Current Invoice] <> 0)),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows1",{"Item No.", "Current Invoice"})
in
    #"Removed Other Columns"[/SIZE]

edit:
if you want vba you need to wait for someone else ;)
 
Last edited:
Upvote 0
I did not really understand how that code works. I made a new sheet and tried going to Data> From Other Sources > From Microsoft Query and opened my source file to get the message "data source contains no visible tables" (I guess because there are no tables :D). I am not allowed to do anything to the source worksheet formatting including making tables.
 
Upvote 0
Data - Show Queries - on the right side you'll see 1 query - right click - Edit - in new window - Home - Advanced Editor - in first line change path to this file to real full path, eg. C:\... etc.. then ok, close and load

example excel file

edit: before above you should save file on your computer, Desktop or any other place....
 
Last edited:
Upvote 0
I downloaded the example file. When I change the values in the main sheet the changes are not reflected in the summary. Such as if I current invoice for Item #2 to zero then the summary should update to show only Items 4 & 6.
 
Upvote 0
I'd definitely prefer a solution that does not involve VBA, but I want the summary to update without my doing anything or maybe just one click.
 
Upvote 0
it was done with your example. I didn't see more in the first post and even in description. No structure, no type of data etc etc.
if you want update right click on the green table and select refresh

solution is an option so you can use or not

have a nice day
 
Upvote 0
I added more sections with dummy data then refresh and it works as you can see

sections.jpg
 
Upvote 0

Forum statistics

Threads
1,214,426
Messages
6,119,417
Members
448,895
Latest member
omarahmed1

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