i have a data table laid out in the following manner;
ColA ColB ColC ColD ColE ColF
Product Desc Ohio Georgia NewYork Indiana
X A 5 4 3 4
Y B 3 2 5 1
Z C 6 3 6 2
I want to create a sumtotal in ColG from ColC,ColD,ColE and ColF but all vaules in ColC have to be multiplied by a factor of 2, colD by 3, colE by 1.5 and colF by 3.5.
This list is dynamic and can grow by rows and columns. The factor by which a state is multiplied will always be the same for the state. Essentially, the factor for all states will be coded and will never change.
How can i loop through all the col's with state names, evaluate the name, apply the factor and sum the result for every state in colG.
this what i use to just sum the data by product
Dim cv As Range
Dim lastcol As Long
lastcol = Range("A4").End(xlToRight).Column
For Each cv In Range(Sheet2.Range("A4").End(xlToRight).Offset(1, 1), Cells(Rows.Count, "A").End(xlUp).Offset(0, lastcol))
rn = cv.Row
cv.Value = Application.Sum(Range(cv.Offset(0, -1), "C" & (rn)))
Next cv
Sheet2.Range("A4").End(xlToRight).Offset(0, 1).Value = "Ttl Trx Count"
But i also need to need to add the factors based on the state name and sum all that as well. Any ideas on how to get there will be helpfull.
Thanks
Bookmarks