Hello ..
How to multiply a value of a row of a column to all the values in another column and do the loop for all rows.Then, at the end, sum the values in each row?
Thanks so much for your help!!
Here is an example.
| C 1 | C2 | C3 |
| 40 | 1 | 40 |
| 30 | 2 | 110 |
| 20 | 3 | 200 |
| 10 | 140 | |
|
80
30
|
Please note that I do not want to have or show these three columns (I, II, III) in my table. but I just put them in here to show the steps. Column 2 could have lots of rows...
Here is what I have done...
The loop works only for the 1st two rows in Column 3..!!? I can not figure it out! Thanks a lot for your help!
Dim i As Integer
For k As Integer = 0 To Data1.ColumnCount - 4
For j = 0 to Data1.Rows.Count - 2
Data1.Rows(j).Cells(2).Value = Data1.Rows(j).Cells(0).Value * Data1.Rows(j).Cells(1).Value
For i = 0 To EOF()
i = i + 1
Data1.Rows(j).Cells(3).Value = Data1.Rows(j).Cells(0).Value * Data1.Rows(k+i).Cells(1).Value + Data1.Rows(j).Cells(2).Value
Next i
Next j
Next k
Rupesh KahanePosted Sep 30, 2018, 1:27 PM
Ako MushaPosted Sep 28, 2018, 3:56 PM
Rupesh KahanePosted Sep 28, 2018, 1:27 PM
Ako MushaPosted Sep 28, 2018, 10:18 AM
Thanks Rupesh for the comment. I had an image in my original posting, which was describing the steps.
Rupesh KahanePosted Sep 28, 2018, 2:46 AM