0

I have in Google Sheets (or Excel) a cell with a content =2*34+3*39

I need to sum up all the numbers used before the multiplication, in this example it would be 5 (2+3).

Is there any formula in Google Sheets or Excel to do this work?

There are hundreds of different formulas, but I can't find any suitable.

example

example

2 Answers2

0

This will take an assumption, that the formula only use + for each mulification:

=sum(query(arrayformula(split(transpose(split(REGEXREPLACE(FORMULATEXT(A38), "=", ""), "+")), "*")), "select Col1"))

And this with an assumption, that the formula use + and each has multification:

=sum(arrayformula(value(regexextract(transpose(split(REGEXREPLACE(FORMULATEXT(A38), "=", ""), "+")), "^(.*)[*]"))))
user11982798
  • 1,732
  • 1
  • 3
  • 8
-1

sure:

=LEN(REGEXREPLACE(FORMULATEXT(A1); "[^*]"; ))

0


=ARRAYFORMULA(SUM(1*IFERROR(REGEXEXTRACT(SPLIT(REGEXREPLACE(
 FORMULATEXT(A1); "(\*)"; "$1♥"); "♥"); "(\d+)\*"); 0)))

0

player0
  • 69,261
  • 8
  • 33
  • 67