Table of Contents
This article provides a clear overview of Split Numbers from Strings in Excel, with the main facts, useful context, and practical details organized for easy reading.
There are 2 ways to separate numbers:
- Case 1: Separate numbers from series and get positive values.
- Case 2: Separate numbers from series and take both positive and negative values.
1. Separate Numbers from Series and Get Positive Values
Step 1: Open the Excel File to decompose -> Press the key combination Alt + F11 -> VBA window appears -> Go to the Insert tab -> Module .

Step 2: At the command prompt, enter the following code:

Function ExtractNumber (rCell As Range) Dim lCount As Long Dim sText As String Dim lNum As String sText = rCell For lCount = Len (sText) To 1 Step -1 If IsNumeric (Mid (sText, lCount, 1)) Then lNum = Mid (sText, lCount, 1) & lNum End If Next lCount ExtractNumber = CLng (lNum) End Function
Note: Remember this function name because when returning to Excel File must use it.
Step 3: After importing, click Save (because it contains a macro, when saving, display a message box, choose OK) -> Return to Excel File to find the function as shown:

Step 4: Copy the formula for the remaining cells with the following results:

2. Separate Numbers from the String and Take Both Positive and Negative Values
Step 1: Open the Excel File to decompose -> Press the key combination Alt + F11 -> VBA window appears -> Go to the Insert tab -> Module .

Step 2: At the command prompt, enter the following code:

Private Function SuperTrim (TheStr As String) Dim Temp As String, DoubleSpase As String DoubleSpase = Chr (32) & Chr (32) Temp = Trim (TheStr) Temp = Replace (Temp, DoubleSpase, Chr (32)) Do Until InStr ( Temp, DoubleSpase) = 0 Temp = Replace (Temp, DoubleSpase, Chr (32)) Loop SuperTrim = Temp End Function Public Function Tach_So (strText As String) Dim strText_1 As String Dim subText () As String, so () As Double Dim i As Integer, j As Integer, k As Integer, m As Integer strText = SuperTrim (strText) subText = Split (strText, "") For i = 0 To UBound (subText) For j = 1 To Len (subText (i) ) k = 0 If IsNumeric (Mid (subText (i), j, 1)) _ Or (Mid (subText (i), j, 1) = "-" And IsNumeric (Mid (subText (i), j + 1 , 1))) Then k = j Exit For End If Next j If k <> 0 Then m = m + 1 strText_1 = Val (Mid (subText (i),k)) ReDim Preserve so (1 To m) As Double so (m) = strText_1 End If Next i If index> 0 And index <= m Then Tach_So = so (m) Else Tach_So = "" End If End Function
Note: Remember the function name "" Tach_so () ".
Step 3: Click Save, just select OK . Return to the Excel file and select the Tach_so () function as shown:

Step 4: Tach_so () function has only one parameter that is the number of cells to split.

Step 5: Copy the formula for the remaining cells we have the results:

Thus separating both positive and negative values. And the negative sign in the first position of the cell is obtained.
Note: The above functions only apply to sequences that contain 1 string of consecutive numbers. If the data is a series of different numerical characters separated by alphabetic characters, the return value is the first numeric string.
FAQ
What is the main focus of Split Numbers from Strings in Excel?
The article explains the most important facts, context, and practical details related to Split Numbers from Strings in Excel.
Who may find this information useful?
It is useful for readers who want a clear overview, practical context, and a better understanding of the subject.
What should readers verify before taking action?
Check current product versions, official requirements, regional availability, and any details that may have changed since the original publication.
Reader Comments 0
Sign in with email or Google to join the discussion.