【VBA】同比计算及自定义显示函数(V1.1)

Function YOY(A, B)
Application.Volatile True
If B < 0 Then
    If A > B Then
        If A > 0 Then
            YOY = "★"
        Else
            YOY = "☆"
        End If
    Else
        If A = B Then
            YOY = "〓"
        Else
            YOY = "▲"
        End If
    End If
Else
    If B = 0 Then
        If A > B Then
            YOY = "☆0"
        Else
            If A = B Then
                YOY = ""
            Else
                YOY = "▲"
            End If
        End If
    Else
        If Abs((A - B) / B * 100) < 1000 Then
            YOY = (A - B) / B * 100
        Else
            If A > B Then
                YOY = ">1000" & "★"
            Else
                YOY = "<1000" & "▲"
            End If
        End If
    End If
End If
End Function

你可能感兴趣的:(【VBA】同比计算及自定义显示函数(V1.1))