add a new row

  • Thread starter Thread starter NuB
  • Start date Start date
N

NuB

Currently in code i'm populating an excel file and grouping the data, now I
need to add a row with a total for each group, in code how can i add a total
of each group?

Example:
BMW
25,463
69,000
12,000

Total 106,463
Lexus
72,000
25,000
13,000
total 110,000

how can i accomplish something like this?
 
Sort your date on the column
In the menu in Excel go to
Data=>Subtotals
(then follow the wizard)
If you want a macro, turn on the macro recorder while you apply it.

Another approach would be to create a pivot table (also under the data
menu).
 
all of those solutions sound great and would work in most cases, but not in
my case. Since I'm populating the file on the fly via .NET is there another
way to do this or no?
 
sure, loop through the data and insert a line when the values in the column
change. Then put in a summation formula. Although, if you can do that, it
is unclear why either of the other methods wouldn't work.
 
what other methods?
I'm not using a template or a pivot table to show the data, i'm just
populating the cells and columns and showing the data that way.
 
That is what I said. It is unclear why the other methods won't work. If
you don't want to use a pivot table, then there is still subtotal which
works inplace.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top