Cells Multiplication offsetting and "resetting" each time

ranashsa

New Member
Joined
Jun 12, 2015
Messages
5
Hi everyone !

For my first post, i thought of asking a stupid question. . Here we go :

I have excel file a bit like that but with random numbers going from 1 to 500000

1020304050
12345
1040100200360

<tbody>
</tbody>



The cells in row two are multiplied with the cells in row 1 beginning with the first cell in row and added to the value of the multiplication of the previous cells "offset by 1 to the right each time
To give you an idea of the calculation

1* 10 = 10 1st column
(1*20) + (2 *10) = second column
(1*30)+ (2*20) + (3 *10) = third column
(1*40) +(2*30)+ (3*20) + (4*10) = 200 fourth and so on


The problem with using a formula is that i have to manually add some part of the formula each time
For example, in the third column , i was able to generate the first two terms using "offset"but i still need to manually enter the third term...:(

Now i have turned to writing a vba code but cannot find a way to do it...(i'm quite new with it and i'm a bit bad with using loops)

Can someone give me a push in the right direction?

Cheers
Vjiranashsa
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi.

I'm confused. You mention only offsetting to the right, yet aren't some of the products formed by offsetting to the left?

For example, your last example:

(1*40) +(2*30)+ (3*20) + (4*10)

does not seem to obey your rule that:

"The cells in row two are multiplied with the cells in row 1 beginning with the first cell in row and added to the value of the multiplication of the previous cells "offset by 1 to the right each time."

Can you clarify?

Regards
 
Upvote 0
Not sure if i understand what you need.

Maybe...


A
B
C
D
E
1
10​
20​
30​
40​
50​
2
1​
2​
3​
4​
5​
3
10​
40​
100​
200​
350​

Formula in A3 copied across
=SUMPRODUCT($A2:A2,N(OFFSET($A$1,,COLUMNS($A3:A3)-(COLUMN($A$1:A1)-COLUMN($A$1)+1))))

Hope this helps

M.
 
Upvote 0
No need for vba, a formula based on this example should work without needing to manually change it each time.

=SUMPRODUCT($A1:A1,N(OFFSET($A2,0,COLUMN(A1)-COLUMN($A1:A1))))
 
Upvote 0
Hi.

I'm confused. You mention only offsetting to the right, yet aren't some of the products formed by offsetting to the left?

For example, your last example:

(1*40) +(2*30)+ (3*20) + (4*10)

does not seem to obey your rule that:

"The cells in row two are multiplied with the cells in row 1 beginning with the first cell in row and added to the value of the multiplication of the previous cells "offset by 1 to the right each time."

Can you clarify?

Regards

hi thanks for taking the time to look at my problem ,

to answer your question what i meant is that each time a new cell is reached, the multiplication starts over from the first cell first row again. then it offsets to the right. hope i made it clearer :)
 
Last edited:
Upvote 0
Not sure if i understand what you need.

Maybe...


A
B
C
D
E
1
10​
20​
30​
40​
50​
2
1​
2​
3​
4​
5​
3
10​
40​
100​
200​
350​

<tbody>
</tbody>


Formula in A3 copied across
=SUMPRODUCT($A2:A2,N(OFFSET($A$1,,COLUMNS($A3:A3)-(COLUMN($A$1:A1)-COLUMN($A$1)+1))))

Hope this helps

M.

Thanks!!!:biggrin: i will try that and get back to you
 
Upvote 0
ahem .... i get value each time.can you explain what the function does( sorry... i'm having a bit of trouble with it)
 
Upvote 0
Did you make any changes to the ranges (cells) used in the formula in order to make it fit your real data?

Please post your edited version so we can see where you went wrong.
 
Upvote 0

Forum statistics

Threads
1,216,014
Messages
6,128,280
Members
449,436
Latest member
blaineSpartan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top