Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Divide two numbers in data subtotal function

I have a report that contains 10,000+ rows of information. I have a macro
written that will insert subtotals (Data...Subtotal) to create logical breaks
in the data. Part of the data is additive, therefore can be easily summed
onto the Subtotal row. However, within the subtotal row, I also need to be
able to divide two numbers together. For example, here is what the report
looks like:

Col A Col B Col C Col D
Spending$ # Units Spending/Unit
Name A $1000 100 $10.00
Name A $2000 50 $40.00
Name A $3000 200 $15.00
--------------------------------------------------------------------------
Name A Total $6000 350 (blank)

When Excel inserts the subtotal row, it sums the Spending$ and # Units
columns, but it cannot create the Spending/Unit calculation. I tried to
write code that would "filter" the subtotal rows after they were inserted,
then copy/paste the appropriate formula across all filtered subtotal rows in
column D, but I got a circular reference error as it appeared that when I did
the copy/paste, it tried to paste over the rows that were filtered out. Is
there a better way for me to insert this Spending/Unit calculation into
column D for ONLY the subtotal rows, leaving the hard-coded values for the
other rows intact?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Divide two numbers in data subtotal function

What you are asking for will be an uphill battle with subtotals. A pivot
table with a calculated field would be a whole pile easier. If you need help
with that just ask...
--
HTH...

Jim Thomlinson


"jday" wrote:

I have a report that contains 10,000+ rows of information. I have a macro
written that will insert subtotals (Data...Subtotal) to create logical breaks
in the data. Part of the data is additive, therefore can be easily summed
onto the Subtotal row. However, within the subtotal row, I also need to be
able to divide two numbers together. For example, here is what the report
looks like:

Col A Col B Col C Col D
Spending$ # Units Spending/Unit
Name A $1000 100 $10.00
Name A $2000 50 $40.00
Name A $3000 200 $15.00
--------------------------------------------------------------------------
Name A Total $6000 350 (blank)

When Excel inserts the subtotal row, it sums the Spending$ and # Units
columns, but it cannot create the Spending/Unit calculation. I tried to
write code that would "filter" the subtotal rows after they were inserted,
then copy/paste the appropriate formula across all filtered subtotal rows in
column D, but I got a circular reference error as it appeared that when I did
the copy/paste, it tried to paste over the rows that were filtered out. Is
there a better way for me to insert this Spending/Unit calculation into
column D for ONLY the subtotal rows, leaving the hard-coded values for the
other rows intact?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Divide two numbers in data subtotal function

This won't really work given the nature of how users will need to work with
this data. They have areas of input & need to be able to see the whole
picture as they are doing this (vs. a pivot table view). I just gave you the
basics of the specific issue I am trying to deal with. Will just do some
creative trial and error to see what I can come up with. Thanks anyway....

"Jim Thomlinson" wrote:

What you are asking for will be an uphill battle with subtotals. A pivot
table with a calculated field would be a whole pile easier. If you need help
with that just ask...
--
HTH...

Jim Thomlinson


"jday" wrote:

I have a report that contains 10,000+ rows of information. I have a macro
written that will insert subtotals (Data...Subtotal) to create logical breaks
in the data. Part of the data is additive, therefore can be easily summed
onto the Subtotal row. However, within the subtotal row, I also need to be
able to divide two numbers together. For example, here is what the report
looks like:

Col A Col B Col C Col D
Spending$ # Units Spending/Unit
Name A $1000 100 $10.00
Name A $2000 50 $40.00
Name A $3000 200 $15.00
--------------------------------------------------------------------------
Name A Total $6000 350 (blank)

When Excel inserts the subtotal row, it sums the Spending$ and # Units
columns, but it cannot create the Spending/Unit calculation. I tried to
write code that would "filter" the subtotal rows after they were inserted,
then copy/paste the appropriate formula across all filtered subtotal rows in
column D, but I got a circular reference error as it appeared that when I did
the copy/paste, it tried to paste over the rows that were filtered out. Is
there a better way for me to insert this Spending/Unit calculation into
column D for ONLY the subtotal rows, leaving the hard-coded values for the
other rows intact?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to divide a numbers in a table of data by 1,000, all at once m2222 New Users to Excel 2 May 13th 23 03:41 AM
Subtotal data excluding negitive numbers. Tony Excel Discussion (Misc queries) 3 December 4th 09 09:39 PM
how to divide numbers mar Excel Worksheet Functions 2 September 26th 09 08:20 AM
Autosum data from 2 columns with Divide function snowball Excel Discussion (Misc queries) 1 August 25th 09 06:12 PM
Subtotal function with Filtered Data RonB Excel Discussion (Misc queries) 3 August 12th 05 10:04 PM


All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"