I've got two lists: one with items and one with orders
Item | Price |
---|---|
1 | 10.10 |
2 | 2.02 |
Order | Item 1 | Item 2 | ... | Item 15 | Sum |
---|---|---|---|---|---|
A | 1 | 10.10 | |||
B | 1 | 2 | 12.12 |
For each order I want to sum up the prices of the items listed in that row (see last column).
I've tried searching for a formula but everything I've found refers to a different problem. Either they want to sum up multiple columns of a single result or they want to look up multiple rows based on a single value. And I've not been able to adapt those formulas or ideas to my problem.
Use MAP()
then SUM()
. Try-
=SUM(MAP(E2:H3,LAMBDA(x,XLOOKUP(x,A2:A,B2:B,0))))
Edit: After comment by OP.
Try-
=BYROW(E2:H3,LAMBDA(r,SUM(MAP(r,LAMBDA(x,XLOOKUP(x,A2:A,B2:B,0))))))
And full dynamic formula to refer all rows.
=BYROW(E2:H,LAMBDA(r,IF(COUNTIFS(r,">0")=0,,SUM(MAP(r,LAMBDA(x,XLOOKUP(x,A2:A,B2:B,0)))))))