第五版FMEA手册AP评价表公式分享
质量工具的 FMEA 在2019年进行更新,取消了S*O*D=RPN的RPN值,改用组合方式的AP值,改用AP后FMEA表再使用的Excel完成时因为是组合方式(如下图),常规公式不易计算(我能想到的就是借助辅助表,把SOD文本先结合起来然后使用查找函数查找字符串的方式进行计算)
我的方法是使用一个自定义公式的进行计算AP值,使用的时候直接使用=AP(S,O,D)(SOD为这个自定义函数的三个参数)的方式获得对应的AP值,使用的效果如下图,代码分享如下,对代码进行了稍微的注释,方便不熟悉的朋友们理解
(结尾有这个自定义函数的添加过程,只分享该方法,模板源文件抱歉无法上传,请朋友们谅解)搞质量又没学习过VBA的朋友应该用得上,但是这个方法有缺点因为要使用VBA,所以模板表需要保存为带宏的.xlsm 文件,做为使用人员如果不清楚把它保存为普通文件,公式会被丢失掉导致错误;
VBA大神来看的话是很简单的,欢迎各大神分享其它更方便的解决方案
’-----------------------------------------------------------------------------------
Function AP(S, O, D) As String
’声明一个自定义函数,函数的参数为S、O、D 三个参数,输出结果为文本型
S = Application.WorksheetFunction.Substitute(S, " ", "")
O = Application.WorksheetFunction.Substitute(O, " ", "")
D = Application.WorksheetFunction.Substitute(D, " ", "")
S = Application.WorksheetFunction.Substitute(S, Chr(10), "")
O = Application.WorksheetFunction.Substitute(O, Chr(10), "")
D = Application.WorksheetFunction.Substitute(D, Chr(10), "") ' 注释:将S O D的空格和换行符两个常见非法字符删除,避免出错
If Not S Like "[1-9]" And S <> 10 Then
AP = "S值错误"
ElseIf Not O Like "[1-9]" And O <> 10 Then
AP = "O值错误"
ElseIf Not D Like "[1-9]" And D <> 10 Then
AP = "D值错误" ' 注释:判断S O D是否为数字1-10,如果不是函数输出为值错误
Else
S = S * 1
O = O * 1
D = D * 1 ' 注释:S O D 转化为数值处理,防止文本型数据导致出错
Select Case S
Case Is >= 9
Select Case O
Case Is >= 6: AP = "H"
Case Is >= 4
Select Case D
Case Is >= 2: AP = "H"
Case Is = 1: AP = "M"
End Select
Case Is >= 2
Select Case D
Case Is >= 7: AP = "H"
Case Is >= 5: AP = "M"
Case Is <= 4: AP = "L"
End Select
Case Is = 1: AP = "L"
End Select
Case Is >= 7
Select Case O
Case Is >= 8: AP = "H"
Case Is >= 6
Select Case D
Case Is >= 2: AP = "H"
Case Is = 1: AP = "M"
End Select
Case Is >= 4
Select Case D
Case Is >= 7: AP = "H"
Case Is <= 6: AP = "M"
End Select
Case Is >= 2
Select Case D
Case Is >= 5: AP = "M"
Case Is <= 4: AP = "L"
End Select
Case Is = 1: AP = "L"
End Select
Case Is >= 4
Select Case O
Case Is >= 8
Select Case D
Case Is >= 5: AP = "H"
Case Is <= 4: AP = "M"
End Select
Case Is >= 6
Select Case D
Case Is >= 2: AP = "M"
Case Is = 1: AP = "L"
End Select
Case Is >= 4
Select Case D
Case Is >= 7: AP = "M"
Case Is <= 6: AP = "L"
End Select
Case Is >= 2: AP = "L"
Case Is = 1: AP = "L"
End Select
Case Is >= 2
Select Case O
Case Is >= 8
Select Case D
Case Is >= 5: AP = "M"
Case Is <= 4: AP = "L"
End Select
Case Is <= 7: AP = "L"
End Select
Case Is = 1: AP = "L"
End Select
' 注释:按第五版标准 AP 表对SOD进行对照得到AP值,输出为函数结果
End If
End Function
‘-----------------------------------------------------------------------------------
以上是代码,添加操作过程如图示(简单图示,方法有很多),完成后就可以正常使用=AP(S,O,D)的自定义函数了
注意最后EXCEL文件请保存为.xlsm格式或.xls格式,普通的xlsx文件不能被存放代码;
如还有写入代码不了的朋友可联系15059730902微信
我的方法是使用一个自定义公式的进行计算AP值,使用的时候直接使用=AP(S,O,D)(SOD为这个自定义函数的三个参数)的方式获得对应的AP值,使用的效果如下图,代码分享如下,对代码进行了稍微的注释,方便不熟悉的朋友们理解
(结尾有这个自定义函数的添加过程,只分享该方法,模板源文件抱歉无法上传,请朋友们谅解)搞质量又没学习过VBA的朋友应该用得上,但是这个方法有缺点因为要使用VBA,所以模板表需要保存为带宏的.xlsm 文件,做为使用人员如果不清楚把它保存为普通文件,公式会被丢失掉导致错误;
VBA大神来看的话是很简单的,欢迎各大神分享其它更方便的解决方案
’-----------------------------------------------------------------------------------
Function AP(S, O, D) As String
’声明一个自定义函数,函数的参数为S、O、D 三个参数,输出结果为文本型
S = Application.WorksheetFunction.Substitute(S, " ", "")
O = Application.WorksheetFunction.Substitute(O, " ", "")
D = Application.WorksheetFunction.Substitute(D, " ", "")
S = Application.WorksheetFunction.Substitute(S, Chr(10), "")
O = Application.WorksheetFunction.Substitute(O, Chr(10), "")
D = Application.WorksheetFunction.Substitute(D, Chr(10), "") ' 注释:将S O D的空格和换行符两个常见非法字符删除,避免出错
If Not S Like "[1-9]" And S <> 10 Then
AP = "S值错误"
ElseIf Not O Like "[1-9]" And O <> 10 Then
AP = "O值错误"
ElseIf Not D Like "[1-9]" And D <> 10 Then
AP = "D值错误" ' 注释:判断S O D是否为数字1-10,如果不是函数输出为值错误
Else
S = S * 1
O = O * 1
D = D * 1 ' 注释:S O D 转化为数值处理,防止文本型数据导致出错
Select Case S
Case Is >= 9
Select Case O
Case Is >= 6: AP = "H"
Case Is >= 4
Select Case D
Case Is >= 2: AP = "H"
Case Is = 1: AP = "M"
End Select
Case Is >= 2
Select Case D
Case Is >= 7: AP = "H"
Case Is >= 5: AP = "M"
Case Is <= 4: AP = "L"
End Select
Case Is = 1: AP = "L"
End Select
Case Is >= 7
Select Case O
Case Is >= 8: AP = "H"
Case Is >= 6
Select Case D
Case Is >= 2: AP = "H"
Case Is = 1: AP = "M"
End Select
Case Is >= 4
Select Case D
Case Is >= 7: AP = "H"
Case Is <= 6: AP = "M"
End Select
Case Is >= 2
Select Case D
Case Is >= 5: AP = "M"
Case Is <= 4: AP = "L"
End Select
Case Is = 1: AP = "L"
End Select
Case Is >= 4
Select Case O
Case Is >= 8
Select Case D
Case Is >= 5: AP = "H"
Case Is <= 4: AP = "M"
End Select
Case Is >= 6
Select Case D
Case Is >= 2: AP = "M"
Case Is = 1: AP = "L"
End Select
Case Is >= 4
Select Case D
Case Is >= 7: AP = "M"
Case Is <= 6: AP = "L"
End Select
Case Is >= 2: AP = "L"
Case Is = 1: AP = "L"
End Select
Case Is >= 2
Select Case O
Case Is >= 8
Select Case D
Case Is >= 5: AP = "M"
Case Is <= 4: AP = "L"
End Select
Case Is <= 7: AP = "L"
End Select
Case Is = 1: AP = "L"
End Select
' 注释:按第五版标准 AP 表对SOD进行对照得到AP值,输出为函数结果
End If
End Function
‘-----------------------------------------------------------------------------------
以上是代码,添加操作过程如图示(简单图示,方法有很多),完成后就可以正常使用=AP(S,O,D)的自定义函数了
注意最后EXCEL文件请保存为.xlsm格式或.xls格式,普通的xlsx文件不能被存放代码;
如还有写入代码不了的朋友可联系15059730902微信