Formula to extract value from text

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,506
Office Version
  1. 2021
Platform
  1. Windows
I have the following text and would like a formula to extract the value for eg 60, 72 etc

Depreciation straight line 60 months
Depreciation straight line 72 months
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
What about a formula for the reverse function?

I have a SUBSTITUTE word formula that replaces words in a URL... but the conversion cell shows the formula. How would i convert that into just text in the next cell over so i can copy it right for the cell and paste in a browser (Without using a HYPERLINK formula)?

Thanks!

 
Upvote 0
VBA Code:

select the range and keep the column next to it empty . Run the macro

Code:
Sub Remove_Alphabets_SpecialChar_Test()
     
    Dim RegX As Object
    Dim Rng As Range
     
    Set RegX = CreateObject("vbscript.regexp")
     
    With RegX
        .Global = True
        .Pattern = "[^-0-9]"
    End With
     
    For Each Rng In selection
        Rng.Offset(, 1) = RegX.Replace(Rng, "")
    Next Rng
     
End Sub
 
Upvote 0
Can it be done with a formula?

Cell B2 shows the URL... but in the formula bar shows the formula... how can i get the URL to show up in the Formula Bar?

VBA Code:

select the range and keep the column next to it empty . Run the macro

Code:
Sub Remove_Alphabets_SpecialChar_Test()
     
    Dim RegX As Object
    Dim Rng As Range
     
    Set RegX = CreateObject("vbscript.regexp")
     
    With RegX
        .Global = True
        .Pattern = "[^-0-9]"
    End With
     
    For Each Rng In selection
        Rng.Offset(, 1) = RegX.Replace(Rng, "")
    Next Rng
     
End Sub
 
Upvote 0
sorry. i meant... is there a way to set a cell as a Paste Special Value and have the conversion take place there?
 
Upvote 0

Forum statistics

Threads
1,203,115
Messages
6,053,588
Members
444,674
Latest member
DWriter9

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