![]() |
Sum columns dynamically
Hi,
I have a table as follows: A1 A2 A3 A4 A5 A6 A7 A8 A9 Description M-6 M-5 M-4 M-3 M-2 M-1 M1 M2 etc etc A 1 2 3 4 5 6 7 8 j 5 6 7 8 9 10 11 12 v 4 5 0 0 0 0 5 6 etc Description M-2 M-1 M1 M2 M3 M4 M5 M6 etc etc hhg 1 2 3 4 5 6 7 8 ert 5 6 7 8 9 10 11 12 pdr 4 5 0 0 0 0 5 6 etc This table is populated from different sources (via VBA), but will always have headings. The problem is, the headings my vary eg one table may have M-1 M1 M2 M3 to M120 another may be as above, but the descrpition (and therefore the table) will always start in Column A. I now need to map this to a different table with any value that is contained in M-6 M-5 M-4 M-3 M-2 M-1 summed in one column in the new table. The items in the description column are all variable etc. Does anyone have any ideas?? |
Sum columns dynamically
One thing you can do is add some code to the VBA to create a listing aside
from the table, with the headers description, Ms, and data. It will be something like: Desc Ms Data A M-6 1 A M-5 2 .... pdr M6 6 If you can manage to get that listing, you can use it as the base for a pivot table, with the description on the rows, the Ms on the columns and the sum of data as the data. It will make all the aggregations for you. Hope this helps, Miguel. "Delboy" wrote: Hi, I have a table as follows: A1 A2 A3 A4 A5 A6 A7 A8 A9 Description M-6 M-5 M-4 M-3 M-2 M-1 M1 M2 etc etc A 1 2 3 4 5 6 7 8 j 5 6 7 8 9 10 11 12 v 4 5 0 0 0 0 5 6 etc Description M-2 M-1 M1 M2 M3 M4 M5 M6 etc etc hhg 1 2 3 4 5 6 7 8 ert 5 6 7 8 9 10 11 12 pdr 4 5 0 0 0 0 5 6 etc This table is populated from different sources (via VBA), but will always have headings. The problem is, the headings my vary eg one table may have M-1 M1 M2 M3 to M120 another may be as above, but the descrpition (and therefore the table) will always start in Column A. I now need to map this to a different table with any value that is contained in M-6 M-5 M-4 M-3 M-2 M-1 summed in one column in the new table. The items in the description column are all variable etc. Does anyone have any ideas?? |
All times are GMT +1. The time now is 01:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com