Search code examples
google-sheets

Calculating the overall value of the cell based on the dictionary in google sheets


I have a value in one cell looking something like this: (The product name and the amount required)

[Product1] 1, [Product2] 2, [Product3] 3

As well i have a dictionary looking something like: (Each product value)

A B
Product1 100
Product2 125
Product3 225

Im curious to know if its possible to get the overall value of the cell's products? So in that case i need to get a value of 1025

Honestly didnt tried much, becuase im not that familiar with google sheets. Don't even know how to approach the problem.


Solution

  • You may try:

    =let(Σ,index(substitute(split(tocol(split(A2,", ",)),"] ",),"[",)),
     sumproduct(ifna(vlookup(index(Σ,,1),E:F,2,)),index(Σ,,2)))
    

    enter image description here