Google Sheets: SUM multiple numbers in same CELL based on Word

Viewed 742
2 Answers

Enter following formula in B2 and Copy it from B2 to D5

=IF($A2="","",IFERROR(MID($A2,(FIND("[",$A2,FIND(B$1,$A2,1))+1),(FIND("]",$A2,FIND("[",$A2,FIND(B$1,$A2,1))+1)-1)-(FIND("[",$A2,FIND(B$1,$A2,1))+1)+1),0)*1)

enter image description here

Edit: As per your comment below, adding formula for Price Columns. Just replace "[" with "€", and reference to the top cells in the columns.

=IF($A3="","",IFERROR(MID($A3,(FIND("€",$A3,FIND(B$1,$A3,1))+1),(FIND("]",$A3,FIND("€",$A3,FIND(B$1,$A3,1))+1)-1)-(FIND("€",$A3,FIND(B$1,$A3,1))+1)+1),0)*1)

enter image description here

Please use this formula in cell B2:

=TRANSPOSE(QUERY({ArrayFormula( 
                   {REGEXEXTRACT(QUERY(flatten(ArrayFormula(IFERROR(SPLIT(A3:A,",")))),"where Col1 <>''"),"[^\[]+"), 
                    REGEXEXTRACT(QUERY(flatten(ArrayFormula(IFERROR(SPLIT(A3:A,",")))),"where Col1 <>''"),"\[(\d+)")*1}) 
                }, "select sum(Col2) group by Col1 label sum(Col2) '' "))

enter image description here

Functions used:
+ TRANSPOSE
+ QUERY
+ ArrayFormula
+ REGEXEXTRACT
+ flatten Undocumented
+ IFERROR
+ SPLIT

Related