You can't "build" a formula in this manner.
You can still do it with an added step.
Let's assume this formula in cell A2: =C5&C6&C7&C8
Returns the TEXT string: =countif(D20:E25,"JohnSmith")
With the cell selected do:
Right click>copy
Right click>Paste Special>Values
CTRL H (this opens the Find/Replace userform)
Find what: =
Replace with: =
Replace all
The cell should now contain the formula: =COUNTIF(D20:E25,"JohnSmith")
However, this is kind of going around in circles when you could have just typed in the COUNTIF formula.
What you need is a UDF (User Defned Function).
Put this code into a general module:
Then, this formula entered in some cell:![]()
Function EVAL(Equation As String) As Variant Application.Volatile EVAL = Evaluate(Equation) End Function
=EVAL(A2)
Bookmarks