Function Price(Product As String) As Variant
If Product = "Apples" Then
Price = 12.5
ElseIf Product = "Oranges" Then
Price = 15
ElseIf Product = "Pears" Then
Price = 18
ElseIf Product = "Mangoes" Then
Price = 25
Else
Price = CVErr(xlErrNA)
End If
End Function
Sub test()
MsgBox CStr(Price("Oranges"))
End Sub