Copy only numbers

oreo haven

Board Regular
Joined
May 15, 2008
Messages
65
I have a Value Stream Map where I need to have a formula look into a cell and only copy the number in that cell....ie. cell A2 has the following : Cycle time = 33 minutes.

I have several places that are going to refer to that 33 minutes, however, I just want the cells to display 33. Does anyone know how I can write a formula that will do that? I am so new to excel that the only thing I have tried to do is cellX=A2 Of course I know that this will not work, but I don't know what will.
Any and all help is appreciated.
Jon
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Here is a User Defined Function that will take a string and return just the numbers from it (if there are no numbers, it will return 0).
Code:
Function GetNumber(MyEntry As String)
    
    Dim i As Byte
    
    If Len(MyEntry) > 0 Then
        For i = 1 To Len(MyEntry)
            If IsNumeric(Mid(MyEntry, i, 1)) Then
                GetNumber = GetNumber & Mid(MyEntry, i, 1)
            End If
        Next i
    End If
    
End Function
If you turn on the Macro Recorder, then press Stop, then go to Tools | Macro, then highlight "Macro1" and click Edit, it will take you into the VB Editor. Simply paste the code above what is in there and Save and Exit.

Then you can use this function like any other native Excel function. So if your entry is in cell A2, then this formula would return the numeric part of that value:

=GetNumber(A2)
 
Upvote 0
Thanks for that. When I searched I found plenty of solutions for removing the numbers but not the letters.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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