Link to home
Start Free TrialLog in
Avatar of polygonsheep
polygonsheep

asked on

Excel macro to multiply 2 columns (independant of number of rows)?

Hi,

I have excel sheets with sales data and I want to create a macro to multiply the last 2 columns together into a new column. Each row of the 2 columns is multiplied separately. Then sum all the numbers in the last (new) column.  I know how to multiply 2 columns in the same row and copy that for all rows but the rows will change from sheet to sheet. So the macro needs to know how many total rows there are. Here's an example

x  x   3   $1.00
x  x   5   $1.25
x  x  10   $0.75


so I want a macro to give me
x  x   3   $1.00  $3.00
x  x   5   $1.25  $6.25
x  x  10   $0.75  $7.50
                  $16.75



The macro should also work if there are 5 rows of data or 50 or 1 billion, etc. Any ideas would be greatly appreciated. Thanks!

ASKER CERTIFIED SOLUTION
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There is the SUMPRODUCT function, details see Help.
Avatar of polygonsheep
polygonsheep

ASKER

wow!!! Thanks Lowfatspread!  But I guess I neglected to mention the rows I want to use start on row 7. There is other gobaly goop in rows 1 through 6. I'll try and decipher the macro but if you know the quick fix I'd appreciate it.  Thanks!!!!!

BTW, when I delete rows 1-6 the macro works great!
Woot! Just figured it out. Thanks again!!!