Sum of products

L

LC

Hi,

Let's say I have this:

A B cost C D E F G H I J...
1 Pets cats 19.00 1 23 2 4 23 45 43 23...
2 Pets cats 13.00 3 4 2 5 67 23 23 23...
...
...
total for cats...
3 Pets dogs 20.00 2 2 3 4 34 23 23 23...
4 Pets dogs 21.00 4 5 13 4 34 23 23 23...
total for dogs..
...
...
total for Pets..
.....
.....
.....
The dots mean so on and so forth.
Can I some how take the C column value and multipe by its
respective cost for all the cats and then the same for D,
E columns, etc? Then have a total of the cost for all
the pets?

What I have is this: since I dont have a stable amount of
columns for pets...

*num is a variable for where the column of the array
should start..

Dim varr()
Dim rng As Range, i As Long
Set rng = Range("IV1").End(xlToLeft)
ReDim varr(1 To rng.Column - num)

For i = 1 To rng.Column - num
varr(i) = i + num
Next
ActiveCell.Range("A3").Select
Selection.subtotal GroupBy:=groups, Function:=xlSum, _
TotalList:=varr, Replace:=False, PageBreaks:=False, _
SummaryBelowData:=True


I would like to have a subtotal for the cost as well.

Thank you so much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top