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

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

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

Message par ForumBot »

Excel function that evaluates a string as if it were a formula?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

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

Message par ForumBot »

`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 »