I have this data and i have the script for sort.
It is not giving me the correct sort not sure why. any help
output with script
It is not giving me the correct sort not sure why. any help
FTTH_Customer_Complains_Weekly_V1.xlsm | ||||||||
---|---|---|---|---|---|---|---|---|
L | M | N | O | P | Q | |||
7 | HAY | w-21 | w-22 | w-23 | w-24 | w-25 | ||
8 | RIYADH_Yasmeen | 1 | 0 | 8 | 6 | 3 | ||
9 | RIYADH_Tuwaiq | 2 | 1 | 1 | 2 | 0 | ||
10 | RIYADH_Al Nadhim | 0 | 0 | 1 | 1 | 2 | ||
11 | RIYADH_As Sahafah | 0 | 3 | 2 | 4 | 2 | ||
12 | RIYADH_Ishbiliyyah | 1 | 0 | 3 | 4 | 1 | ||
13 | RIYADH_Al Yarmuk | 1 | 3 | 6 | 1 | 1 | ||
14 | RIYADH_Al Munsiyah | 0 | 1 | 1 | 0 | 1 | ||
15 | ||||||||
16 | RIYADH_Al Malqa | 0 | 2 | 7 | 1 | 1 | ||
17 | ||||||||
18 | ||||||||
19 | ||||||||
20 | ||||||||
21 | ||||||||
22 | 0 | 0 | 0 | 0 | 0 | 0 | ||
23 | RIYADH_Al Qadisiyah | 0 | 0 | 0 | 0 | 0 | ||
24 | RIYADH_Dherat Al Laben | 0 | 2 | 0 | 3 | 2 | ||
25 | ||||||||
26 | ||||||||
27 | ||||||||
28 | ||||||||
29 | ||||||||
30 | JEDDAH_Bani Malik | 0 | 0 | 0 | 0 | 0 | ||
31 | ||||||||
32 | ||||||||
PerHAY Phone Count working |
Cell Formulas | ||
---|---|---|
Range | Formula | |
M7:Q7 | M7 | =E7 |
L8:L21,L23:L32 | L8 | =IF(D8="","",D8) |
M8:M21,M23:M32 | M8 | =IF(L8="","",COUNTIFS('cst cc Data'!$K:$K,L8,'cst cc Data'!$E:$E,$M$6)) |
N8:N21,N23:N32 | N8 | =IF(L8="","",COUNTIFS('cst cc Data'!$K:$K,L8,'cst cc Data'!$E:$E,$N$6)) |
O8:O21,O23:O32 | O8 | =IF(L8="","",COUNTIFS('cst cc Data'!$K:$K,L8,'cst cc Data'!$E:$E,$O$6)) |
P8:P21,P23:P32 | P8 | =IF(L8="","",COUNTIFS('cst cc Data'!$K:$K,L8,'cst cc Data'!$E:$E,$P$6)) |
Q8:Q21,Q23:Q32 | Q8 | =IF(L8="","",COUNTIFS('cst cc Data'!$K:$K,L8,'cst cc Data'!$E:$E,$Q$6)) |
output with script
FTTH_Customer_Complains_Weekly_V1.xlsm | ||||||||
---|---|---|---|---|---|---|---|---|
BL | BM | BN | BO | BP | BQ | |||
2 | HAY | w-21 | w-22 | w-23 | w-24 | w-25 | ||
3 | ||||||||
4 | ||||||||
5 | ||||||||
6 | ||||||||
7 | ||||||||
8 | ||||||||
9 | ||||||||
10 | ||||||||
11 | ||||||||
12 | ||||||||
13 | ||||||||
14 | ||||||||
15 | ||||||||
16 | RIYADH_Yasmeen | 1 | 0 | 8 | 6 | 3 | ||
17 | RIYADH_Al Nadhim | 0 | 0 | 1 | 1 | 2 | ||
18 | RIYADH_As Sahafah | 0 | 3 | 2 | 4 | 2 | ||
19 | RIYADH_Dherat Al Laben | 0 | 2 | 0 | 3 | 2 | ||
20 | RIYADH_Ishbiliyyah | 1 | 0 | 3 | 4 | 1 | ||
21 | RIYADH_Al Yarmuk | 1 | 3 | 6 | 1 | 1 | ||
22 | RIYADH_Al Munsiyah | 0 | 1 | 1 | 0 | 1 | ||
23 | RIYADH_Al Malqa | 0 | 2 | 7 | 1 | 1 | ||
24 | RIYADH_Tuwaiq | 2 | 1 | 1 | 2 | 0 | ||
25 | 0 | 0 | 0 | 0 | 0 | 0 | ||
26 | RIYADH_Al Qadisiyah | 0 | 0 | 0 | 0 | 0 | ||
27 | JEDDAH_Bani Malik | 0 | 0 | 0 | 0 | 0 | ||
Graphs |
VBA Code:
With targetSheet.Sort
.SortFields.Clear
.SortFields.Add Key:=targetSheet.Range("BQ2:BQ27"), _
SortOn:=xlSortOnValues, _
Order:=xlDescending, _
DataOption:=xlSortNormal
.SetRange targetCellclean
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With