I have added a customer fuction to my personal.xls as coded below
Function Discount(quantity, price)
'Calculates a discount for orders greater than 100 units
If quantity >= 100 Then 'If more than 100 units
Discount = quantity * price * 0.1 'Calculate a 10% discount
Else
Discount = 0 'Otherwise, no discount
End If
Discount = Application.Round(Discount, 2) 'Round to 2 places
End Function
however when I try and use it in a spreadsheet eg =discount(C9,D9) it comes up with a #name? error in the cell as if the function cannot be found any ideas where I am going wrong?
Jd
Function Discount(quantity, price)
'Calculates a discount for orders greater than 100 units
If quantity >= 100 Then 'If more than 100 units
Discount = quantity * price * 0.1 'Calculate a 10% discount
Else
Discount = 0 'Otherwise, no discount
End If
Discount = Application.Round(Discount, 2) 'Round to 2 places
End Function
however when I try and use it in a spreadsheet eg =discount(C9,D9) it comes up with a #name? error in the cell as if the function cannot be found any ideas where I am going wrong?
Jd