3

Please help me solve this problem. I'm trying to search all similar part of a string combine them then add all their numeric value at the beginning part of the string.

Input: cell A1

2 x Onsemi 3000K E27; 7 x Onsemi 3000K E27; 9 x Phoenix Eco 7W 4000K B22; 1 x Phoenix Eco 7W 4000K B22

Output: cell B1

9 x Onsemi 3000K E27; 10 x Phoenix Eco 7W 4000K B22

Tried using google match function but struggling on how to combine them then add the quantity. Your help is highly appreciated.

player0
  • 124,011
  • 12
  • 67
  • 124
Enrico Mendiola
  • 131
  • 1
  • 7

1 Answers1

2
=ARRAYFORMULA(TEXTJOIN("; ", 1, TRANSPOSE(QUERY(TRANSPOSE(QUERY({
 REGEXEXTRACT(TRANSPOSE(SPLIT(A1, ";")), "(\d+)")*1,
 REGEXEXTRACT(TRANSPOSE(SPLIT(A1, ";")), "\d+ (.*)")}, 
 "select sum(Col1),Col2 
  group by Col2 
  label sum(Col1)''", 0)),,999^99))))

0

player0
  • 124,011
  • 12
  • 67
  • 124