Extract Data Contains Mark etc...As Number

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all..

how to extract data below (contains mark etc.)
Book1
KL
3data (text)target (number)
4 = 1.812,00 m3 x 610.383,00 /m3 x 0,840 1,812.00
5 = 579,00 m3 x 610.383,00 /m3 x 0,840 579.00
6 = 20,00 m3 x 610.383,00 /m3 x 0,840 20.00
7 = 24.500,00 m3 x 610.383,00 /m3 x 0,840 24,500.00
8 = 356.500,00 m3 x 610.383,00 /m3 x 0,840 356,500.00
9 = 1.750.500,00 m3 x 610.383,00 /m3 x 0,840 1,750,500.00
Sheet1

my target in cell L4 down and as number not text

any help would greatly appreciated..

.sst
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
i want to extract or pull data from col.K, number can be extracted is number at first from left before mark "m3" first
 
Upvote 0
VBA Code:
Sub test()
    Dim lr, i, m
    Dim a As Variant
    lr = Sheets("sheet1").Cells(Sheets("sheet1").Rows.Count, 11).End(xlUp).Row
    a = Cells(4, 11).Resize(lr - 3)
    With CreateObject("VBScript.RegExp")
        .Global = True
        .Pattern = "(\d+\.\d+\,..)"
        For i = 1 To UBound(a)
            Set m = .Execute(a(i, 1))
            Cells(i + 3, 11).Offset(, 1) = m(0) * 1
        Next
    End With
End Sub
 
Upvote 0
This may be better
VBA Code:
Sub test()
    Dim lr, i, m
    lr = Sheets("sheet1").Cells(Sheets("sheet1").Rows.Count, 11).End(xlUp).Row
    With CreateObject("VBScript.RegExp")
        .Global = True
        .Pattern = "(\d+\.\d+\,..)"
        For i = 1 To lr - 3
            Set m = .Execute(Cells(i + 3, 11))
            Cells(i + 3, 11).Offset(, 1) = m(0) * 1
        Next
    End With
End Sub
 
Upvote 0
@mohadin,

Your VBA code posted in post 6 an 7 gave incorect results.
1.812,00​
610.383,00
610.383,00
24.500,00​
356.500,00​
750.500,00
 
Upvote 0
@Tom.Jones
OOps
u'r right
So...
What about
VBA Code:
Sub test()
    Dim lr, i, m
    lr = Sheets("sheet1").Cells(Sheets("sheet1").Rows.Count, 1).End(xlUp).Row
    With CreateObject("VBScript.RegExp")
        .Global = True
        For i = 1 To lr
            .Pattern = "(\d.+?\d+? {1,10})"
            Set m = .Execute(Cells(i, 1))
            Cells(i, 1).Offset(, 1) = m(0)
            .Pattern = "\."
            Cells(i, 1).Offset(, 1) = .Replace(m(0), "")
            .Pattern = "\,"
            Cells(i, 1).Offset(, 1) = Format(.Replace(Cells(i, 1).Offset(, 1), "."), "#,##00.00")
        Next
    End With
End Sub
 
Upvote 0
@Tom.Jones
OOps
u'r right
So...
What about
VBA Code:
Sub test()
    Dim lr, i, m
    lr = Sheets("sheet1").Cells(Sheets("sheet1").Rows.Count, 1).End(xlUp).Row
    With CreateObject("VBScript.RegExp")
        .Global = True
        For i = 1 To lr
            .Pattern = "(\d.+?\d+? {1,10})"
            Set m = .Execute(Cells(i, 1))
            Cells(i, 1).Offset(, 1) = m(0)
            .Pattern = "\."
            Cells(i, 1).Offset(, 1) = .Replace(m(0), "")
            .Pattern = "\,"
            Cells(i, 1).Offset(, 1) = Format(.Replace(Cells(i, 1).Offset(, 1), "."), "#,##00.00")
        Next
    End With
End Sub

hi...i have checked actually not true show "invalid procedure"
 
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,304
Members
448,564
Latest member
ED38

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