you can try
Public Function IfFunc(condition As Boolean, trueValue As Double, falseValue As Double) As Double If condition Then IfFunc = trueValue Else IfFunc = falseValue End If End Function