Excel function that evaluates a string as if it were a formula?

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Excel function that evaluates a string as if it were a formula?

Message par Clippy »

Excel function that evaluates a string as if it were a formula?
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: Excel function that evaluates a string as if it were a formula?

Message par Clippy »

`EVALUATE` is available in VBA in all current versions

You can include it in you VBA code, or wrap it into a simple UDF to make it available as a worksheet function

`Function ev(r As Range) As Variant
ev = Evaluate(r.Value)
End Function

```

It basically treats the value of the passed parameter as an Excel formula, same as if it were entered in a cell

`"11+5"` and `"=11+5"` will produce the same result
Répondre

Revenir à « Excel & VBA »