ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
楼主: snood

[转帖]Excel绘制SPC范例

[复制链接]

TA的精华主题

TA的得分主题

发表于 2010-5-11 03:37 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
哈hA 分享下

TA的精华主题

TA的得分主题

发表于 2010-9-5 18:31 | 显示全部楼层
受教了,学习了,很好的分享

TA的精华主题

TA的得分主题

发表于 2010-9-24 14:23 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2010-12-10 12:44 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
下载研究,需要好好理解一下SPC,目前也遇到这方面的问题了,谢谢斑竹

TA的精华主题

TA的得分主题

发表于 2010-12-11 22:02 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
很大的启迪,回去慢慢研究

TA的精华主题

TA的得分主题

发表于 2010-12-14 17:59 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2010-12-16 17:30 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
真羡慕你们  同样是excel  我不会!!!

TA的精华主题

TA的得分主题

发表于 2010-12-19 10:12 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
提供了一个很好的样本,值得参考,谢谢楼主。

TA的精华主题

TA的得分主题

发表于 2011-1-14 15:51 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2011-8-24 15:35 | 显示全部楼层
Option Explicit

Function CheckErrorByRange(ByVal ragTarget As Range, sgUCL As Single, sgLCL As Single) As Single
   
    Dim ragCell As Range
    Dim arSeries() As Single
    Dim i As Integer
    Dim sgTemp As Single
   
    ReDim arSeries(255)
    For Each ragCell In ragTarget
        arSeries(i) = ragCell
        i = i + 1
        If i > 255 Then
            Exit For
        End If
    Next ragCell
   
    ReDim Preserve arSeries(i - 1)
    CheckErrorByRange = GetPatternID(arSeries, sgUCL, sgLCL)
   
End Function

Function ExtractBinByDec(iDec As Integer, iDigit As Integer) As Integer
   
    Dim i As Integer
    Dim iRet As Integer
    For i = 1 To iDigit
        iRet = iDec - 2 * Int(iDec / 2)
        iDec = Int(iDec / 2)
    Next i
    ExtractBinByDec = iRet
   
End Function
Private Function GetPatternID(varSeries As Variant, sgUCL As Single, sgLCL As Single) As Integer
   
    Dim i As Integer
    Dim iLength As Integer
    Dim iExist As Integer
   
    Dim iReturn As Integer
    Dim sgCL As Single
    Dim sgSigma As Single
   
    Dim iUCount As Integer
    Dim iLCount As Integer
   
    sgCL = (sgUCL + sgLCL) / 2
    sgSigma = (sgUCL - sgLCL) / 6
   
    iLength = UBound(varSeries)
   
    'Test 1: 1 point more than 3s from center line
    iExist = 0
    If varSeries(iLength) > sgUCL Or varSeries(iLength) < sgLCL Then
        iExist = 1
    End If
    iReturn = iReturn + 2 ^ 0 * iExist
   
    'Test 2: 9 points in a row on same side of center line
    iUCount = 0
    iLCount = 0
    iExist = 0
    For i = 0 To 8
        If varSeries(iLength - i) > sgCL Then
            iUCount = iUCount + 1
        ElseIf varSeries(iLength - i) < sgCL Then
            iLCount = iLCount + 1
        End If
    Next i
    If iUCount = 9 Or iLCount = 9 Then
        iExist = 1
    End If
    iReturn = iReturn + 2 ^ 1 * iExist
   
    'Test 3: 6 points in a row, all increasing or all decreasing
    iUCount = 0
    iLCount = 0
    iExist = 0
    For i = 0 To 5
        If varSeries(iLength - i) > varSeries(iLength - i - 1) Then
            iUCount = iUCount + 1
        ElseIf varSeries(iLength - i) < varSeries(iLength - i - 1) Then
            iLCount = iLCount + 1
        End If
    Next i
    If iUCount = 6 Or iLCount = 6 Then
        iExist = 1
    End If
    iReturn = iReturn + 2 ^ 2 * iExist
   
    'Test 4: 14 points in a row, alternating up and down
    iUCount = 0
    iLCount = 0
    iExist = 0
    For i = 0 To 10 Step 2
        If varSeries(iLength - i) > varSeries(iLength - i - 1) And varSeries(iLength - i - 1) < varSeries(iLength - i - 2) Then
            iUCount = iUCount + 1
        ElseIf varSeries(iLength - i) < varSeries(iLength - i - 1) And varSeries(iLength - i - 1) > varSeries(iLength - i - 2) Then
            iLCount = iLCount + 1
        End If
    Next i
    If iUCount = 6 Or iLCount = 6 Then
        iExist = 1
    End If
    iReturn = iReturn + 2 ^ 3 * iExist
   
    'Test 5:  2 out of 3 points > 2s from center line (same side)
    iUCount = 0
    iLCount = 0
    iExist = 0
    For i = 0 To 2
        If varSeries(iLength - i) > (sgCL + 2 * sgSigma) Then
            iUCount = iUCount + 1
        ElseIf varSeries(iLength - i) < (sgCL - 2 * sgSigma) Then
            iLCount = iLCount + 1
        End If
    Next i
    If iUCount >= 2 Or iLCount >= 2 Then
        iExist = 1
    End If
    iReturn = iReturn + 2 ^ 4 * iExist

    'Test 6: 4 out of 5 points > 1s from center line (same side)
    iUCount = 0
    iLCount = 0
    iExist = 0
    For i = 0 To 4
        If varSeries(iLength - i) > (sgCL + 1 * sgSigma) Then
            iUCount = iUCount + 1
        ElseIf varSeries(iLength - i) < (sgCL - 1 * sgSigma) Then
            iLCount = iLCount + 1
        End If
    Next i
    If iUCount >= 4 Or iLCount >= 4 Then
        iExist = 1
    End If
    iReturn = iReturn + 2 ^ 5 * iExist
   
    'Test 7: 15 points in a row within 1s of center line (either side)
    iUCount = 0
    iLCount = 0
    iExist = 0
    For i = 0 To 14
        If varSeries(iLength - i) < (sgCL + 1 * sgSigma) And varSeries(iLength - i) >= sgCL Then
            iUCount = iUCount + 1
        ElseIf varSeries(iLength - i) > (sgCL - 1 * sgSigma) And varSeries(iLength - i) <= sgCL Then
            iLCount = iLCount + 1
        End If
    Next i
    If iUCount + iLCount = 15 Then
        iExist = 1
    End If
    iReturn = iReturn + 2 ^ 6 * iExist
   
    'Test 8: 8 points in a row > 1s from center line (either side)
    iUCount = 0
    iLCount = 0
    iExist = 0
    For i = 0 To 7
        If varSeries(iLength - i) > (sgCL + 1 * sgSigma) Then
            iUCount = iUCount + 1
        ElseIf varSeries(iLength - i) < (sgCL - 1 * sgSigma) Then
            iLCount = iLCount + 1
        End If
    Next i
    If iUCount + iLCount = 8 Then
        iExist = 1
    End If
    iReturn = iReturn + 2 ^ 7 * iExist
   
    GetPatternID = iReturn
   
End Function
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-12-26 15:52 , Processed in 0.043669 second(s), 6 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表