Is there a way to take a text in a cell that says 5*5 and to parse to make the result 25... using QUERY function or any of the other built-in functions...?
3 Answers
No. But if you have all such Mathematical expressions in a defined range(say,A5:A7), then you can use Find and Replace
FIND:
^
REPLACE:
=
Range:
Sheet1!A5:A7
Checkmark "Search using regular expressions". Click Replace all. Otherwise you'll need scripts.

- 45,448
- 6
- 62
- 85
-
I would want to do this systematically with a built in function... one solution I came up with was to use multiple cells. – CodeCamper Jul 27 '18 at 13:26
-
@Code If you have a solution, Please post an answer – TheMaster Jul 27 '18 at 14:10
IF you are just looking to parse simple mathematical expressions (+,-,x,/), then it can be done, but not in a single formula.
First, you can split
the text based on your math operator, which will provide the numbers. Then you can use regexextract
to output the math operator, then use a nested if
to perform the needed math operation on the numbers, based upon that operator. You can hide the intermediate columns to put the answer next to the original.
Note that if you need to do more complex operations or operations on more than two numbers, this will not work.

- 442
- 3
- 8
-
This seems to be the only solution I could come with. Although I like how you actually used the multiply and add functions to make it cleaner looking. Like you said the limitation is to simple functions or this could really get out of hand... but in my application it was just a simple calculation. – CodeCamper Jul 27 '18 at 17:37