Function

leon1974mk

New Member
Joined
Feb 25, 2021
Messages
24
Office Version
  1. 2016
Platform
  1. 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)

99
77
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)
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,215,603
Messages
6,125,788
Members
449,260
Latest member
Mrw1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top