Extract information from cells

Mantiyeah

New Member
Joined
Sep 19, 2018
Messages
8
So I have a column with information like this:

XC-163 0827m Timber problems
0600m failed picture cv-76
ligts out 0987m p3
etc

What I need is to create a column only with the measurement info in it which goes behind the m, in this case:
0827
0600
0987

Any ideas of which functions I can use?

Thanks!
 
I don't think you're quite getting my point. You have to kind of isolate 4 numbers and an m specifically, otherwise there will be problems. The other formula suggested would fail here too. My UDF however still returns the correct value:


Excel 2010
ABCD
1This is a dream 4m to 0750m and afterdreaam 40750
Sheet1
Cell Formulas
RangeFormula
B1=MID(A1,SEARCH(" ????m "," "&A1&" "),4)
C1=RIGHT(LEFT(A1,SEARCH("m ",A1&" ",MIN(FIND({0,1,2,3,4}+{0;5},A1&1/17)))-1),4)
D1=getmeasurement(A1)
 
Last edited:
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Finally understood... and yet I wanted to solve the problem by formula rather than VBA
I think I've done :)

Ctrl+Shift+Enter NOT just Enter

B1 =MID(A1,MAX(1,MIN(IFERROR(SEARCH(" "&TEXT(--MID(A1,ROW($1:$55),4),"0000")&"m"," "&A1),9^9))),4)


[TABLE="width: 446"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]XC-163 1227m Timber problems 0425m[/TD]
[TD]1227[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]0600m failed picture cv-76[/TD]
[TD]0600[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]ligts out 0987m p3[/TD]
[TD]0987[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]some other text 0123m[/TD]
[TD]0123[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]from 3em now to 3752m and after[/TD]
[TD]3752[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]frohm 3453m 4m to 0750m and after[/TD]
[TD]3453[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]from 5m now to 1750m and after[/TD]
[TD]1750[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]r 0523m 4m to 0750m and after[/TD]
[TD]0523[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]XC-163 1227m Timber problems 0425m[/TD]
[TD]1227[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]XC-163 237m Timber problems 0425m[/TD]
[TD]0425[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]XC-163 234527m Timber problems 0425m[/TD]
[TD]0425[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]XC-163 dream 34527m Timber problems 0425m[/TD]
[TD]0425[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]This is a dream 4m to 0750m and after[/TD]
[TD]0750[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]1600m failed picture cv-76[/TD]
[TD]1600[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Yet another UDF version...

Code:
Function NumX(S As String) As String
Dim RX As Object: Set RX = CreateObject("VBScript.RegExp")
Dim Pattern As String: Pattern = "(\d{4})(m)"


With RX
    .Global = True
    .IgnoreCase = True
    .MultiLine = True
    .Pattern = Pattern
    Set MX = .Execute(S)
End With


NumX = MX(0).submatches(0)
        
End Function
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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