Reputation: 1419
I have a spreadsheet where I insert two columns prior to my total columns and populate with data.
Eg.
A B C D E F G H
May-12 Jun-12 Jul-12 Total
Spend #Trans Spend #Trans Spend #Trans Spend #Trans
3 $100 1 $200 3 $400 10 --->See formula Below
The sum formula for Total Spend up to Jun-12 is:
=SUM(A3,C3)
Could I store the cell values into an array and then write the formula?
Now need to add Jul-12
=SUM(A3,C3,E3)
My question is when I insert the columns for July data in between Jun-12 and Total, how can I write a macro to update the formula to add the new column for Spend and #Trans?
Upvotes: 0
Views: 292
Reputation: 53137
Try this
=SUMIFS(3:3,2:2,"Spend")
or if you are using Excel 2003 or earlier
=SUMIF(2:2,"Spend",3:3)
Upvotes: 1