ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   add a new row (https://www.excelbanter.com/excel-programming/330519-add-new-row.html)

NuB

add a new row
 
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?



Tom Ogilvy

add a new row
 
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).

--
Regards,
Tom Ogilvy

"NuB" <CSharpCoder wrote in message
...
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?





NuB

add a new row
 
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?

"Tom Ogilvy" wrote in message
...
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).

--
Regards,
Tom Ogilvy

"NuB" <CSharpCoder wrote in message
...
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?







Tom Ogilvy

add a new row
 
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.

--
Regards,
Tom Ogilvy


"NuB" <CSharpCoder wrote in message
...
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?

"Tom Ogilvy" wrote in message
...
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).

--
Regards,
Tom Ogilvy

"NuB" <CSharpCoder wrote in message
...
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?









NuB

add a new row
 
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.
"Tom Ogilvy" wrote in message
...
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.

--
Regards,
Tom Ogilvy


"NuB" <CSharpCoder wrote in message
...
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?

"Tom Ogilvy" wrote in message
...
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).

--
Regards,
Tom Ogilvy

"NuB" <CSharpCoder wrote in message
...
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?











Tom Ogilvy

add a new row
 
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.

--
Regards,
Tom Ogilvy


"NuB" <CSharpCoder wrote in message
...
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.
"Tom Ogilvy" wrote in message
...
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.

--
Regards,
Tom Ogilvy


"NuB" <CSharpCoder wrote in message
...
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?

"Tom Ogilvy" wrote in message
...
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).

--
Regards,
Tom Ogilvy

"NuB" <CSharpCoder wrote in message
...
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?














All times are GMT +1. The time now is 05:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com