Google-sheets – If cell contains a text string assign a value to another cell

formulasgoogle sheetsgoogle-sheets-arrayformulavlookup

This is my Google Sheet.

I have a number of "shopping" cells formatted to have a dropdown list of products/words using the (right-click) "data validation" function.

I have another cell I want to come up with a total price of all the products chosen from the various "shopping" cells, given each product/word has a defined number value/price.

e.g.

cell 1 chooses "widget1"
cell 2 chooses "widget4"
cell 3 chooses "widget7"

widget1 costs 10
widget4 costs 13
widget7 costs 25

Finally, I want a total price cell to show the total price of all the products chosen.

Best Answer

={"Price";
 ARRAYFORMULA(IF(LEN(A8:A),
 IFERROR(VLOOKUP(A8:A, E2:F4, 2, 0), 0)+
 IFERROR(VLOOKUP(B8:B, G2:H4, 2, 0), 0)+
 IFERROR(VLOOKUP(C8:C, I2:J4, 2, 0), 0), ))}

o