![]() |
macro to automatically sum a column based on another
Hello:
I have a spreadsheet that, among other columns, has an inventory item column and a quantity column. The inventory item column has several records with item A, item B, item C, etc. The number of items column has several records also with 8 for A in one record, 2 for A in another record, 3 for A in another record, 4 for B in another record, 5 for B in another record, 9 for C in another record, 7 for C in another record, etc. I want to create a macro that automatically sums the quantity of each item A, B, and C. I'm not concerned with a total quantity for the entire spreadsheet--just a total for each item. How do I program Excel to have such a macro? I'm sure that the solution is simple. I'm just not familiar with creating Excel macros. Thanks! childofthe1980s |
macro to automatically sum a column based on another
You might be able to use the SUMIF worksheet function in your code to
accomplish that task... Mark "childofthe1980s" wrote in message ... Hello: I have a spreadsheet that, among other columns, has an inventory item column and a quantity column. The inventory item column has several records with item A, item B, item C, etc. The number of items column has several records also with 8 for A in one record, 2 for A in another record, 3 for A in another record, 4 for B in another record, 5 for B in another record, 9 for C in another record, 7 for C in another record, etc. I want to create a macro that automatically sums the quantity of each item A, B, and C. I'm not concerned with a total quantity for the entire spreadsheet--just a total for each item. How do I program Excel to have such a macro? I'm sure that the solution is simple. I'm just not familiar with creating Excel macros. Thanks! childofthe1980s |
macro to automatically sum a column based on another
Actually, no. You use Data...Subtotals. Very easy.
Thanks for the input, just the same. childofthe1980s "Mark Ivey" wrote: You might be able to use the SUMIF worksheet function in your code to accomplish that task... Mark "childofthe1980s" wrote in message ... Hello: I have a spreadsheet that, among other columns, has an inventory item column and a quantity column. The inventory item column has several records with item A, item B, item C, etc. The number of items column has several records also with 8 for A in one record, 2 for A in another record, 3 for A in another record, 4 for B in another record, 5 for B in another record, 9 for C in another record, 7 for C in another record, etc. I want to create a macro that automatically sums the quantity of each item A, B, and C. I'm not concerned with a total quantity for the entire spreadsheet--just a total for each item. How do I program Excel to have such a macro? I'm sure that the solution is simple. I'm just not familiar with creating Excel macros. Thanks! childofthe1980s |
All times are GMT +1. The time now is 01:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com