原创EXCEL VBA SPC自定义函数包括CPK PPK CPWord格式.docx
《原创EXCEL VBA SPC自定义函数包括CPK PPK CPWord格式.docx》由会员分享,可在线阅读,更多相关《原创EXCEL VBA SPC自定义函数包括CPK PPK CPWord格式.docx(6页珍藏版)》请在冰豆网上搜索。
Dimbrr()
ForEchrInrng
IfrngIsNothingThenSetrng=rElseSetrng=Union(rng,r)
ForEchcInr
Next
n=rng.Cells.Count
=rng.Columns.Count
bb=rng.Rows.Count
cc=ppliction.WorksheetFunction.Ceiling(n/5,1)
If>
1Then
ReDimrr(1Tobb)
Fori=1Tobb
Setrngi=rng(i,1).Resize(1,)
rr(i)=ppliction.Mx(rngi.Vlue)-ppliction.Min(rngi)
F=ppliction.WorksheetFunction.verge(rr)
trr=
[{0,1.128,1.693,2.059,2.326,2.534,2.704,2.847,2.97,3.078,3.173,3.258,3.336,3.407,3.472,3.532,3.588,3.64,3.689,3.735,3.778,3.819,3.858}]
T=trr()
stdevR=F/T
Else
e=0
ReDimbrr(1Tocc)
Fori=1Tocc
Setrngi=rng(1,1).Resize(5,1).Offset(e,0)
brr(i)=ppliction.Mx(rngi.Vlue)-ppliction.Min(rngi)
e=e+5
F=ppliction.WorksheetFunction.verge(brr)
T=2.326
EndIf
EndFunction
##################ppk=min(ppu,ppl)=(1-k)*pp整体的过程能力指数带中心值的
Functionppk(USLsVrint,LSLsVrint,Prmrryrng()sVrint)sVrint
DimVsSingle,rngsRnge,nsInteger,TsSingle,SumNsSingle,SEsSingle,ksSingle
T=USL-LSL
V=ppliction.WorksheetFunction.verge(rng)
SumN=SumN+ppliction.WorksheetFunction.Power(r-V,2)
SE=Sqr(SumN/(n-1))
k=bs(((((USL+LSL)/2)-V)/(T/2)))
IfUSL="
"
ndLSL="
Or(1-k)*T/(SE*6)<
0Then
ppk="
*"
ppk=(1-k)*T/(SE*6)
##################cpk=min(cpu,cpl)=(1-k)*cp组间的过程能力指数带中心值的Functioncpk(USLsVrint,LSLsVrint,Prmrryrng()sVrint)sVrint
DimVsSingle,rngsRnge,nsInteger,TsSingle,SumNsSingle,SEsSingle,ksSingle,sSingle
SE=stdevR(rng)
Or(1-k)*(T/(SE*6))<
cpk="
cpk=(1-k)*(T/(SE*6))
##################ppu=(USL-X)/3*S上限过程能力指数
Functionppu(USLsVrint,Prmrryrng()sVrint)sVrint
DimVsSingle,rngsRnge,nsInteger,TsSingle,SumNsSingle,SEsSingle
SumN=SumN+ppliction.WorksheetFunction.Power(r-V,2)'
计算平方和
Or(USL-V)/(3*SE)<
ppu="
ppu=(USL-V)/(3*SE)
FunctionCPU(USLsVrint,Prmrryrng()sVrint)sVrint
DimVsSingle,rngsRnge,nsInteger,TsSingle,SumNsSingle,SEsSingleForEchrInrng
CPU="
CPU=(USL-V)/(3*SE)
##################ppl=(X-LSL)/3*S下限过程能力指数
Functionppl(LSLsVrint,Prmrryrng()sVrint)sVrint
IfLSL="
Or(V-LSL)/(3*SE)<
ppl="
ppl=(V-LSL)/(3*SE)
Functioncpl(LSLsVrint,Prmrryrng()sVrint)sVrint
DimVsSingle,rngsRnge,nsSingle,TsSingle,SumNsSingle,SEsSingleForEchrInrng
n=(V-LSL)/(3*SE)
Orn<
cpl="
cpl=n
##################k