1

I want excel (and google spreadsheets) to read a text as a formula.

Cell A1: 1+2

Cell A2: =readAsFormula(A1)

So cell A2 should show 3.

Can`t find any way to do it, and I wanted to avoid making a custom function for it.

Any ideas?

player0
  • 124,011
  • 12
  • 67
  • 124
  • left() and right() then use an if() to recognize and drive a calculation. But a UDF is much easier, think I have a q+a doing that on here. – Solar Mike Jun 20 '22 at 17:13
  • @SolaMike can you elaborate more? Could not understand how you would apply that. – Marcus Arnhold Jun 20 '22 at 17:24
  • If you want Excel to read it as a formula then use this on a VBA Module: `Public Function evaluateCell(cellValue As String) evaluateCell = Evaluate(cellValue) End Function` And on Cell A2 do: `=evaluateCell(A1)` – Ricardo A Jun 20 '22 at 18:08

1 Answers1

2

in google sheets use in cell A2:

=QUERY(;"select "&A1)
player0
  • 124,011
  • 12
  • 67
  • 124