J
Jose
Hi,
I don't know if this can be done, given my limited experience with VB
and Excel. Let me try to simplify the problem as much as I can,
maintaining the issue as I have it.
Imagine you have this data. In column A, the different products you
sell. Column B, with the price. Column C, with the units sold. Those
three columns get downloaded from a database. Now, I want to populate
column D as follows:
A B
C D
1 " Model A" $200 10
=B1*C1
2 " Model B" $100 15
=B2*C2
3 " Model C" $500 25
=B3*C3
4 "Family 1" 30
=SUM(D13)
5 " Model D" $100 15
=B5*C5
6 " Model E" $200 10
=B6*C6
7 "Family 2" 25
=SUM(D56)
I can easily populate column D, EXCEPT the "SUM" function. I do a "For
each" loop, selecting all data in column A, and if the first character
in cell A1, A2, etc, is "space", I can input the multiplication,
although not too elegantly... I have a cell, hidden in a safe place,
with the formula that multiplies the 2 adjacent cells. So I can just
copy that cell into D1, D2, D3, D5 and D6.
The problem is that, when I detect that in A4, the first character is
not space, I don't know how to enter the SUM formula. NOTE: Sometimes,
the "Family 1" will have 3 submodels, as above, but it can change and
be 5, or 2 models. So I don't know, in advance, how many cells I will
have to add.
I was thinking about having a counter that tells me from which row to
which row I need to calculate the sum, but I don't know what to do
with this two values! In this example, in D4 I can have the values 1
and 3, as the extremes, and in cell D7 I can have the values 5 and 6
as extremes, but I don't know what to do with them!!
Ideas?
Thanks!!
Jose
I don't know if this can be done, given my limited experience with VB
and Excel. Let me try to simplify the problem as much as I can,
maintaining the issue as I have it.
Imagine you have this data. In column A, the different products you
sell. Column B, with the price. Column C, with the units sold. Those
three columns get downloaded from a database. Now, I want to populate
column D as follows:
A B
C D
1 " Model A" $200 10
=B1*C1
2 " Model B" $100 15
=B2*C2
3 " Model C" $500 25
=B3*C3
4 "Family 1" 30
=SUM(D13)
5 " Model D" $100 15
=B5*C5
6 " Model E" $200 10
=B6*C6
7 "Family 2" 25
=SUM(D56)
I can easily populate column D, EXCEPT the "SUM" function. I do a "For
each" loop, selecting all data in column A, and if the first character
in cell A1, A2, etc, is "space", I can input the multiplication,
although not too elegantly... I have a cell, hidden in a safe place,
with the formula that multiplies the 2 adjacent cells. So I can just
copy that cell into D1, D2, D3, D5 and D6.
The problem is that, when I detect that in A4, the first character is
not space, I don't know how to enter the SUM formula. NOTE: Sometimes,
the "Family 1" will have 3 submodels, as above, but it can change and
be 5, or 2 models. So I don't know, in advance, how many cells I will
have to add.
I was thinking about having a counter that tells me from which row to
which row I need to calculate the sum, but I don't know what to do
with this two values! In this example, in D4 I can have the values 1
and 3, as the extremes, and in cell D7 I can have the values 5 and 6
as extremes, but I don't know what to do with them!!
Ideas?
Thanks!!
Jose