Create new Function in Excel

前端 未结 1 718
一生所求
一生所求 2021-01-28 07:01

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

相关标签:
1条回答
  • 2021-01-28 07:47

    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
    
    0 讨论(0)
提交回复
热议问题