I created a \"IF Formula\" in excel and wanted to convert that formula in function I read multiple article; but unable to convert formula into function: Formula
As the comments stated remove the dcell =
and make the function return a String
instead of a Long
. and you were missing a "
in the third line.
Function AccountType(dCell As Variant) As String
If Left(dCell, 4) = "0321" Then
AccountType = "12 - ABC type"
ElseIf Left(dCell, 3) = "021" Then
AccountType = "543 - XYZ type"
Else
AccountType = "Logic Missing"
End If
End Function