smide
Board Regular
- Joined
- Dec 20, 2015
- Messages
- 164
- Office Version
- 2016
- Platform
- Windows
Hello.
In columns A (A2:A600) and B (B2:B600) I have products and in columns C (C2:C600) and D (D2:D600) their prices.
When product is in column A his price is in column C (same row) and when product is in column B his price is in column D.
In column E I have a list of all products (in cells E2:E50).
With array forumla in cell F2:
=IF(E2="","",LOOKUP(9.99999999999999E+307,IF($A$2:$A$600=E2,$C$2:$C$600,IF($B$2:$B$600=E2,$D$2:$D$600)))) , I can find last value/price for each product but I need average of last three prices.
example.
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/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][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Product list[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]orange[/TD]
[TD]apple[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]7[/TD]
[TD]orange[/TD]
[TD="align: center"]7.33[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD]tomato[/TD]
[TD]peach[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]14[/TD]
[TD]peach[/TD]
[TD]...[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD]cabbage[/TD]
[TD]orange[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]9[/TD]
[TD]...[/TD]
[TD]...[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD]orange[/TD]
[TD]plum[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD]apple[/TD]
[TD]peach[/TD]
[TD="align: center"]16[/TD]
[TD="align: center"]11[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD]plum[/TD]
[TD]orange[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]8[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD]...[/TD]
[TD]....[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
explanation: Last three orange prices are 8 (D7), 5 (C5), 9 (D4) -- =(8+5+9)/3 = 7.33
*Any solution with helper columns would be fine also.
In columns A (A2:A600) and B (B2:B600) I have products and in columns C (C2:C600) and D (D2:D600) their prices.
When product is in column A his price is in column C (same row) and when product is in column B his price is in column D.
In column E I have a list of all products (in cells E2:E50).
With array forumla in cell F2:
=IF(E2="","",LOOKUP(9.99999999999999E+307,IF($A$2:$A$600=E2,$C$2:$C$600,IF($B$2:$B$600=E2,$D$2:$D$600)))) , I can find last value/price for each product but I need average of last three prices.
example.
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/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][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Product list[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]orange[/TD]
[TD]apple[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]7[/TD]
[TD]orange[/TD]
[TD="align: center"]7.33[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD]tomato[/TD]
[TD]peach[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]14[/TD]
[TD]peach[/TD]
[TD]...[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD]cabbage[/TD]
[TD]orange[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]9[/TD]
[TD]...[/TD]
[TD]...[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD]orange[/TD]
[TD]plum[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD]apple[/TD]
[TD]peach[/TD]
[TD="align: center"]16[/TD]
[TD="align: center"]11[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD]plum[/TD]
[TD]orange[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]8[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD]...[/TD]
[TD]....[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
explanation: Last three orange prices are 8 (D7), 5 (C5), 9 (D4) -- =(8+5+9)/3 = 7.33
*Any solution with helper columns would be fine also.