Use IIF to calculate value
Function Tax(ProfitBeforeTax As Double) As Double Tax = IIf(ProfitBeforeTax > 0, 0.3 * ProfitBeforeTax, 0) End Function Sub test() MsgBox Tax(100) End Sub