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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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)


AB
1XC-163 1227m Timber problems 0425m1227
20600m failed picture cv-760600
3ligts out 0987m p30987
4some other text 0123m0123
5from 3em now to 3752m and after3752
6frohm 3453m 4m to 0750m and after3453
7from 5m now to 1750m and after1750
8r 0523m 4m to 0750m and after0523
9XC-163 1227m Timber problems 0425m1227
10XC-163 237m Timber problems 0425m0425
11XC-163 234527m Timber problems 0425m0425
12XC-163 dream 34527m Timber problems 0425m0425
13This is a dream 4m to 0750m and after0750
141600m failed picture cv-761600

<tbody>
</tbody>
 
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,215,992
Messages
6,128,165
Members
449,428
Latest member
d4vew

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