[COLOR=navy]Sub[/COLOR] MG22Jul51
'[COLOR=green][B]forum 4 (forum)[/B][/COLOR]
[COLOR=navy]Dim[/COLOR] Rng [COLOR=navy]As[/COLOR] Range, Dn [COLOR=navy]As[/COLOR] Range, n [COLOR=navy]As[/COLOR] [COLOR=navy]Long,[/COLOR] ac [COLOR=navy]As[/COLOR] [COLOR=navy]Long,[/COLOR] Q [COLOR=navy]As[/COLOR] Variant, c [COLOR=navy]As[/COLOR] [COLOR=navy]Long[/COLOR]
[COLOR=navy]Dim[/COLOR] K [COLOR=navy]As[/COLOR] Variant, col [COLOR=navy]As[/COLOR] [COLOR=navy]Long,[/COLOR] nAc [COLOR=navy]As[/COLOR] [COLOR=navy]Long[/COLOR]
[COLOR=navy]Dim[/COLOR] t, tt
[COLOR=navy]With[/COLOR] Sheets("Data")
[COLOR=navy]Set[/COLOR] Rng = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
[COLOR=navy]End[/COLOR] With
[COLOR=navy]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] Dn [COLOR=navy]In[/COLOR] Rng
[COLOR=navy]If[/COLOR] Not .Exists(Dn.Value) [COLOR=navy]Then[/COLOR]
ReDim nray(1 To 41, 1 To 3)
[COLOR=navy]For[/COLOR] n = 3 To UBound(nray, 1)
[COLOR=navy]If[/COLOR] UCase(Dn.Offset(, n - 2).Value) = "Y" [COLOR=navy]Then[/COLOR] nray(n, 1) = 1
[COLOR=navy]If[/COLOR] UCase(Dn.Offset(, n - 2).Value) = "Y" Or UCase(Dn.Offset(, n - 2).Value) = "N" [COLOR=navy]Then[/COLOR]
nray(n, 2) = 1
[COLOR=navy]End[/COLOR] If
[COLOR=navy]If[/COLOR] Not UCase(Dn.Offset(, n - 2).Value) = "Y" And Not UCase(Dn.Offset(, n - 2).Value) = "N" [COLOR=navy]Then[/COLOR]
nray(n, 3) = 1
[COLOR=navy]End[/COLOR] If
[COLOR=navy]Next[/COLOR] n
.Item(Dn.Value) = Array(nray, 1)
[COLOR=navy]Else[/COLOR]
Q = .Item(Dn.Value)
[COLOR=navy]For[/COLOR] n = 3 To UBound(Q(0))
[COLOR=navy]If[/COLOR] UCase(Dn.Offset(, n - 2).Value) = "Y" [COLOR=navy]Then[/COLOR] Q(0)(n, 1) = Q(0)(n, 1) + 1
[COLOR=navy]If[/COLOR] UCase(Dn.Offset(, n - 2).Value) = "Y" Or UCase(Dn.Offset(, n - 2).Value) = "N" [COLOR=navy]Then[/COLOR]
Q(0)(n, 2) = Q(0)(n, 2) + 1
[COLOR=navy]End[/COLOR] If
[COLOR=navy]If[/COLOR] Not UCase(Dn.Offset(, n - 2).Value) = "Y" And Not UCase(Dn.Offset(, n - 2).Value) = "N" [COLOR=navy]Then[/COLOR]
Q(0)(n, 3) = Q(0)(n, 3) + 1
[COLOR=navy]End[/COLOR] If
[COLOR=navy]Next[/COLOR] n
Q(1) = Q(1) + 1
.Item(Dn.Value) = Q
[COLOR=navy]End[/COLOR] If
[COLOR=navy]Next[/COLOR]
ReDim ray(1 To .Count + 2, 1 To 80)
ray(1, 1) = Rng(1).Offset(-1)
ray(1, 2) = "Count of Audits"
[COLOR=navy]For[/COLOR] ac = 3 To UBound(ray, 2) [COLOR=navy]Step[/COLOR] 2
nAc = nAc + 1
ray(1, ac) = Rng(1).Offset(-1, nAc)
ray(2, ac) = "y/(y+n)"
ray(1, ac + 1) = Rng(1).Offset(-1, nAc)
ray(2, ac + 1) = "Other"
[COLOR=navy]Next[/COLOR] ac
c = 2
[COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] K [COLOR=navy]In[/COLOR] .Keys
c = c + 1
nAc = 2
ray(c, 1) = K
ray(c, 2) = .Item(K)(1)
[COLOR=navy]For[/COLOR] ac = 3 To UBound(ray, 2) [COLOR=navy]Step[/COLOR] 2
nAc = nAc + 1
[COLOR=navy]If[/COLOR] Not IsEmpty(.Item(K)(0)(nAc, 2)) [COLOR=navy]Then[/COLOR]
ray(c, ac) = Format(.Item(K)(0)(nAc, 1) / .Item(K)(0)(nAc, 2), "0%")
[COLOR=navy]End[/COLOR] If
[COLOR=navy]If[/COLOR] Not IsEmpty(.Item(K)(0)(nAc, 3)) [COLOR=navy]Then[/COLOR]
ray(c, ac + 1) = Format(.Item(K)(0)(nAc, 3) / .Item(K)(1), "0%")
[COLOR=navy]End[/COLOR] If
col = col + 1
[COLOR=navy]Next[/COLOR] ac
[COLOR=navy]Next[/COLOR] K
[COLOR=navy]End[/COLOR] With
[COLOR=navy]With[/COLOR] Sheets("Results2").Range("A1").Resize(c, UBound(ray, 2))
.Parent.Cells.NumberFormat = "general"
.Value = ray
.Borders.Weight = 2
.Cells.ColumnWidth = 7
.Parent.Rows(1).WrapText = True
.Parent.Rows(1).AutoFit
[COLOR=navy]End[/COLOR] With
MsgBox "End"
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]