|
楼主 |
发表于 2011-1-10 16:04
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
原帖由 晨曦吉林 于 2008-11-19 19:08 发表
写的不错.个税的计算在年底是一件大活.
年底了,该算年终奖了吧,呵呵。贴一下最近更新的计算各种所得税的自定义函数:
=iiatax(年终奖金,4)
-
- Function iiatax(x As Double, y As Integer) '独立所得税计算函数
- 'y=1 计算中国公民工薪所得税
- 'y=2 计算外国公民工薪所得税
- 'y=3 计算劳务所得税
- 'y=4 计算数月奖金所得税
- If IsNumeric(x) = False Then
- iiatax = "#NUM" '计税工资非数值
- Exit Function
- End If
- If x < 0 Then
- iiatax = "-#VALUE" '计税工资为负
- Exit Function
- End If
- Dim basicnum As Single, i%
- Dim downnum As Variant, upnum As Variant, ratenum As Variant, deductnum As Variant, laowudeduct As Variant
- Dim gongxin!, laowu!, nianjiang!
- downnum = Array(0, 500, 2000, 5000, 20000, 40000, 60000, 80000, 100000) '定义累进区间下限
- upnum = Array(500, 2000, 5000, 20000, 40000, 60000, 80000, 100000, 100000000) '定义累进区间上限
- ratenum = Array(0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45) '定义累进税率
- deductnum = Array(0, 25, 125, 375, 1375, 3375, 6375, 10375, 15375) '定义累进速算扣除数
- Select Case y
- Case 1
- basicnum = 2000 '中国公民个税起征点
- Case 2
- basicnum = 4800 '外籍公民个税起征点
- Case 3 '劳务所得税
- downnum = Array(0, 4000, 20000, 50000)
- upnum = Array(4000, 20000, 50000, 100000000)
- ratenum = Array(0.2, 0.2, 0.3, 0.4)
- deductnum = Array(0, 0, 2000, 7000)
- laowudeduct = Array(800, x * 0.2, x * 0.2, x * 0.2)
- For i = 0 To UBound(downnum)
- If x > downnum(i) And x <= upnum(i) Then laowu = (x - laowudeduct(i)) * ratenum(i) - deductnum(i)
- Next i
- Case 4 '数月奖金计税
- For i = 0 To UBound(downnum)
- If x / 12 > downnum(i) And x / 12 <= upnum(i) Then nianjiang = x * ratenum(i) - deductnum(i)
- Next i
- Case Else
- iiatax = "#N/A" '参数不能识别
- Exit Function
- End Select
- '计算工薪所得税
- For i = 0 To UBound(downnum)
- If x - (basicnum + downnum(i)) > 0 Then gongxin = gongxin + (x - (basicnum + downnum(i))) * 0.05
- Next i
- If y = 3 Or y = 4 Then gongxin = 0
- iiatax = Format(gongxin + laowu + nianjiang, "#.00") * 1
- End Function
复制代码 |
|