Last active
December 29, 2015 09:49
-
-
Save zhimiaoli/7653127 to your computer and use it in GitHub Desktop.
计算个人所得税的自定义函数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function tax(salary As Double) As Double | |
Application.Volatile '让Excel频繁计算,避免更改工资还不更新个税 | |
'''个人所得税计算函数 | |
If salary < 3500 Then | |
tax = 0 | |
Else | |
g = salary - 3500 | |
Select Case g | |
Case Is <= 1500 | |
tax = Round(g * 0.03, 2) | |
Case Is <= 4500 | |
tax = Round(g * 0.1, 2) - 105 | |
Case Is <= 9000 | |
tax = Round(g * 0.2, 2) - 555 | |
Case Is <= 35000 | |
tax = Round(g * 0.25, 2) - 1005 | |
Case Is <= 55000 | |
tax = Round(g * 0.3, 2) - 2755 | |
Case Is <= 80000 | |
tax = Round(g * 0.35, 2) - 5505 | |
Case Is > 80000 | |
tax = Round(g * 0.45, 2) - 13505 | |
End Select | |
End If | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
使用方法
个人宏工作簿
,不要录制任何内容,这样会创建一个personal.xlsb
personal.xlsb
的一个模块中=
,然后在公式栏中点击Fx
,在类别中选择用户定义
,然后就可以看到自定义的函数了。