leon1974mk
New Member
- Joined
- Feb 25, 2021
- Messages
- 24
- Office Version
- 2016
- Platform
- Windows
Can somebody help me with this function. I do not know how to fix
Function REDUX(s As String)
Dim SD As Object: Set SD = CreateObject("Scripting.Dictionary")
Dim AR() As Variant
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "(\d+.\d)\((\d+)\)"
Set matches = .Execute(s)
If matches.Count = 0 Then
REDUX = s
Exit Function
Else
For Each m In matches
SD(m.submatches(0)) = SD(m.submatches(0)) + CDbl(m.submatches(1))
Next m
End If
End With
ReDim AR(0 To SD.Count - 1)
For i = 0 To UBound(AR)
AR(i) = SD.keys()(i) & "(" & SD.items()(i) & ")"
Next i
REDUX = Join(AR, "_")
End Function
I have this column
I need this results in this column(see red. find the same and count total)
Function REDUX(s As String)
Dim SD As Object: Set SD = CreateObject("Scripting.Dictionary")
Dim AR() As Variant
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "(\d+.\d)\((\d+)\)"
Set matches = .Execute(s)
If matches.Count = 0 Then
REDUX = s
Exit Function
Else
For Each m In matches
SD(m.submatches(0)) = SD(m.submatches(0)) + CDbl(m.submatches(1))
Next m
End If
End With
ReDim AR(0 To SD.Count - 1)
For i = 0 To UBound(AR)
AR(i) = SD.keys()(i) & "(" & SD.items()(i) & ")"
Next i
REDUX = Join(AR, "_")
End Function
I have this column
I need this results in this column(see red. find the same and count total)
9 | 9 |
7 | 7 |
2(2)_7(2)_1.7; 2.7; 3.8(2) | 2(2)_7(2)_1.7; 2.7; 3.8(2) |
1(169)_3(169)_10(169)_13; 64(169) | 1(169)_3(169)_10(169)_13; 64(169) |
3(70)_8(70)_3(70)_10(70) | 3(140)_8(70)_10(70) |
3(99)_3(99)_3(99)_3(99) | 3(396) |
2(61)_1.7; 2.7; 3.8(61)_3(61)_10(61) | 2(61)_1.7; 2.7; 3.8(61)_3(61)_10(61) |
4(269)_1.7; 2.7; 3.8(269)_3(269)_4(269) | 4(538)_1.7; 2.7; 3.8(269)_3(269) |
3(1560)_3(1560)_13; 64(1560)_13; 64(1560) | 3(3120)_13; 64(3120) |
1.7; 2.7; 3.8(436)_1.7; 2.7; 3.8(436)_1.7; 2.7; 3.8(436)_2(436)_4(436) | 1.7; 2.7; 3.8(1308)_2(436)_4(436) |
2(262)_2(262)_3(262)_3(262)_3(262)_3(262) | 2(524)_3(1048) |
3(2)_3(2)_3(2)_13; 64(2)_13; 64(2)_4(2) | 3(6)_13; 64(4)_4(2) |
6(187)_13; 64(187)_4(187) | 6(187)_13; 64(187)_4(187) |
6(82)_4(82)_4(82) | 6(82)_4(164) |
5(269)_4(269)_4(269) | 5(269)_4(538) |
2(444)_4(444)_4(444) | 2(444)_4(888) |
4(751)_4(751)_4(751)_4(751)_4(751) | 4(3755) |