smide
Board Regular
- Joined
- Dec 20, 2015
- Messages
- 164
- Office Version
- 2016
- Platform
- Windows
Hello.
In columns A and B (A2:A500 and B2:B500) I have a list of product names (text cells) and in columns C and D their corresponding values (numbers in the range from 0 to 1000).
When product is in column A his value is in column C (in the same row of course) and when the product is in column B his value is in the column D.
I need a formula (if it is possible to create such a formula) to SUM values of last three product's occurences (previous three more precisely) and to place result in the columns E or F in the same row where referent product appears.
example.
Calculation only for Product1 in this example.
Sheet1 (current status)
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product3[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]6[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Product4[/TD]
[TD="align: center"]Product6[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]14[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Product8[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]12[/TD]
[TD="align: center"]45[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product2[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]11[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Product3[/TD]
[TD="align: center"]Product9[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product8[/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]6[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]Product5[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]7[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]....[/TD]
[TD="align: center"]....[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]....[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[/TR]
</tbody>[/TABLE]
Sheet1 (after calculation)
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[TD="align: center"]F[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]Results[/TD]
[TD="align: center"]Results[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product3[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Product4[/TD]
[TD="align: center"]Product6[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]14[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Product8[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]12[/TD]
[TD="align: center"]45[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product2[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]11[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Product3[/TD]
[TD="align: center"]Product9[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product8[/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]54[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]Product5[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"][/TD]
[TD="align: center"]70[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]
4th Product1 is in row 7, in column A then his result is in column E also in row 7 : 7+45+2 = 54 (sum of previous three values for Product1)
5th Product1 is in row 8, in column B then his result is in column F also in row 8 : 18+7+45 = 70 (sum of previous three values for Product1)
In columns A and B (A2:A500 and B2:B500) I have a list of product names (text cells) and in columns C and D their corresponding values (numbers in the range from 0 to 1000).
When product is in column A his value is in column C (in the same row of course) and when the product is in column B his value is in the column D.
I need a formula (if it is possible to create such a formula) to SUM values of last three product's occurences (previous three more precisely) and to place result in the columns E or F in the same row where referent product appears.
example.
Calculation only for Product1 in this example.
Sheet1 (current status)
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product3[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]6[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Product4[/TD]
[TD="align: center"]Product6[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]14[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Product8[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]12[/TD]
[TD="align: center"]45[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product2[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]11[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Product3[/TD]
[TD="align: center"]Product9[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product8[/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]6[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]Product5[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]7[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]....[/TD]
[TD="align: center"]....[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]....[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[/TR]
</tbody>[/TABLE]
Sheet1 (after calculation)
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[TD="align: center"]F[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]Results[/TD]
[TD="align: center"]Results[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product3[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Product4[/TD]
[TD="align: center"]Product6[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]14[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Product8[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]12[/TD]
[TD="align: center"]45[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product2[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]11[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Product3[/TD]
[TD="align: center"]Product9[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]Product8[/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]54[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]Product5[/TD]
[TD="align: center"]Product1[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"][/TD]
[TD="align: center"]70[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"]...[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]
5th Product1 is in row 8, in column B then his result is in column F also in row 8 : 18+7+45 = 70 (sum of previous three values for Product1)
Last edited: