|
楼主 |
发表于 2019-1-3 11:07
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Function tax(Optional a = 0, Optional b = 0)
'tax(本月累计预缴应纳税所得,上月累计预缴应纳税所得)
Application.Volatile
tax = IIf(gts(a) > gts(b), gts(a) - gts(b), 0)
End Function
Function gts(Optional x = 0, Optional y = 1)
'gts(累计预缴应纳税所得额,一次性应纳税所得额,y=12)
Application.Volatile
i% = 1: b = x / y
For Each c In Array(0, 36000, 144000, 300000, 420000, 660000, 960000)
If b > c / y Then gts = gts + (x - c / y) * 0.05 * Choose(i, 0.6, 1.4, 2, 1, 1, 1, 2): i = i + 1
Next c
gts = Round(gts + 0.0001, 2)
End Function
Function sr#(Optional aa = 0)
'sr(全部应纳税所得额)
Application.Volatile
Dim arr2#, tax#, min#, mm#
Dim i%: min = 999999999
arr1 = Array(0, 36000, 144000, 300000, 420000, 660000, 960000)
For i = 0 To 6
arr2 = aa - arr1(i)
mm = gts(arr1(i)) + gts(arr2, 12)
If mm < min Then
min = mm: sr = arr1(i)
End If
mm = gts(arr1(i), 12) + gts(arr2)
If mm < min Then
min = mm: sr = arr2
ElseIf mm = min Then
If sr < arr2 Then
sr = arr2
End If
End If
Next
End Function
|
评分
-
1
查看全部评分
-
|