How to remove special characters from numbers?

ivankesaulya

New Member
Joined
Feb 2, 2018
Messages
6
Dear all,

I have some difficulties trying to remove special characters from numbers section.

Here is the example;

13685421965|126
33512485|223654
4698875213615|1
99876252148631|

Help 1:
I need to count how many characters before that special character.

13685421965|126 ---> =LEN(*beforespecialcharacter*)

Help 2:
I need to erase that special character and the numbers written after that special character

13685421965|126 ---> 13685421965
33512485|223654 ---> 33512485
4698875213615|1 ---> 4698875213615
99876252148631| ---> 99876252148631

I can't thank you enough if anyone can help me with these problems :eek::(


Warm regards,

Ivan Kesaulya
+6281318888266
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
In B2 enter:

=LEN(LEFT(A2,FIND("|",A2)-1))

In C2 enter:

=LEFT(A2,B2)

The foregoing set up assumes that | occurs once. Anyways it operates on the first occurrence of the | sign.
 
Upvote 0
Obviously, Aladin's suggestion (native excel) is the way to go but if it would be part of code, this might work.
Code:
Sub AAAAA()
Dim c As Range
For Each c In Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)
    c.Offset(, 1).Value = Trim(Split(c, "|")(0))
Next c
End Sub
BTW, I would remove your phone number unless you want crank calls

Just saw you answer to Aladin. It is not part of code so just save it for possible future use!!!!!
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,292
Members
449,149
Latest member
mwdbActuary

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