Use Alt+F11 to open VB Editor
Use command Insert | Module
Copy this to the newly open module sheet
Function Myfunction(x, y, z)
If z Then
multi = 1
Else
multi = -1
End If
Myfunction = x + y * multi
End Function
Return to Excel and type in any cell =Myfunction(A1,B1, T10)
But why not use
Function Myfunction(x, y, z)
If z Then
Myfunction = x + y
Else
Myfunction = x - y
End If
End Function
best wishes