How to arrange number?

S

Sherees

Hi
I have a column of around 2000 customer mobile numbers, the numbers are
having space in between nad some numbers entered with two zero in the front.
How can i arrange all the numbers without zero in front and without any space
in between? please guide me with the easiest method

Thank u
 
M

Ms-Exl-Learner

Assume that you are having the value in A1 cell like the below:-

A1 cell
0056 4 65

Paste the below formula in B1 cell
=VALUE(SUBSTITUTE(A1," ",""))

Change the cell reference to your desired cell, if required.

Remember to Click Yes, if this post helps!
 
S

Sherees

Hi
Thank u for ur reply, when i pasted ur formula its showing a number like
this 9.66501E+11
i want the number without decimal value coz these are mobile numbers with
country code and could u pls tell me why it shows a number like
9.66501E+11(this)
 
M

Ms-Exl-Learner

If the Number is within 15 digits then format the cell like the below:

Select the range and do Right Click and select Format
Cells>>Number>>Category>>Custom>> paste the below format

###########0000

Or

###############

If the number is exceeding 15 digits then you need to use the formula like
below:

="'"&VALUE(SUBSTITUTE(A1," ",""))

But the above formula will result you text character instead of Original
Numbers.

Remember to Click Yes, if this post helps!
 
J

Joe User

Sherees said:
could u pls tell me why it shows a number like
9.66501E+11(this)

Because the cell is formatted as General, and it is not wide enough for the
result.

Simply widen the cell. Select the entire column, then click on Format >
Column > Autofit (in Excel 2003).

I would format it as Number. Then, if the cell is not wide enough, you will
see "####", which is the normal signal that tells you that the cell is not
wide enough.

But I would not convert text (the original phone numbers) to numbers in the
first place. That will change any phone number that can be more than 15
characters without leading zeros and interstitial blanks. (Is that possible
with some international phone numbers?)

Returning to your original question, I would do:

=SUBSTITUTE(SUBSTITUTE(A1," ",""),"0","")

You may still need to widen the column.


----- original message -----
 
J

Joe User

Ms-Exl-Learner said:
Select the range and do Right Click and select Format
Cells>>Number>>Category>>Custom>> paste the
below format

..... Or simply make the column wide enough.

If the number is exceeding 15 digits then you
need to use the formula like below:
="'"&VALUE(SUBSTITUTE(A1," ",""))

Adding the apostrophe then is too late. The VALUE function will already
have changed the number. Simply try:

="'"&VALUE("1234567890123456")

PS: Appending an apostrophe like that is not the same as typing an
apostrophe manually. In the case above, the apostrophe actually becomes part
of the string, and it is displayed. I'm sure that is not what you intended.


----- original message -----
 
M

Ms-Exl-Learner

Hi Joe,

I don’t think so widening of columns will work if the number Exceeds 12
digits when it is formatted as General. If cell is in General format and
widening of column will also result the same 1.23457E+13 error.

PS: Appending an apostrophe like that is not the same as typing an
apostrophe manually. In the case above, the apostrophe actually becomes part
of the string, and it is displayed. I'm sure that is not what you intended.

Yes, I though that using apostrophe in front of value function will mark the
cell as text entry and it will show the numbers exactly even though the
length of the number goes beyond 16 digits. But now I realize that this is
the wrong assumption.

But I am seeing the same error in your below formula also,

="'"&VALUE("1234567890123456")

Have you applied the above formula in excel? Because the Length of the
Number is exceeding 15 digits, so it will get the wrong result even though
the cell is formatted as numbers. You can notice that the end value Six will
be changed into zero after pasting the above formula in a cell.

I think there is no benefit of using the apostrophe in front of the value
function, because Value is working with the same methodology like Number
format. Since both Number format and Value functions are showing the correct
results when the length of the Number is upto 15 digits.

Finally about the below formula, substituting of 0 (zero) will remove all
the zeros and result you the text numbers without any zeros.

=SUBSTITUTE(SUBSTITUTE(A1," ",""),"0","")

But the OP is looking to remove the leading zeros like 00020680089005089046
to 20680089005089046. But the above formula will result 2688958946.
 
J

Joe User

Ms-Exl-Learner said:
I don’t think so widening of columns will work if the number Exceeds 12
digits when it is formatted as General.

Correct. Well, it does not work if the number exceeds 10 digits.

In my more-complete response to the OP, I suggested combining that with
formatting as Number. Arguably, your suggestion avoids the extra step; the
column is widened automagically.

But I am seeing the same error in your below formula also,
="'"&VALUE("1234567890123456") [....]
You can notice that the end value Six will be changed into
zero after pasting the above formula in a cell.

That was the point. It is a counter-example to demonstrate that the
apostrophe does not have the desired effect when used in that way. If the
apostrophe had worked as you intended, the last 6 would not be changed to
zero.

Finally about the below formula, substituting of 0 (zero) will remove all
the zeros and result you the text numbers without any zeros.
=SUBSTITUTE(SUBSTITUTE(A1," ",""),"0","")
But the OP is looking to remove the leading zeros

You are correct. My bad.

But my point was: If the phone number might be more than 15 digits long
after removing leading zeros, then it is ill-advised to try to remove
leading zeros by converting the text to a number.


----- original message -----
 
M

Ms-Exl-Learner

I think we can use the Value function for the partial data for removing the
leading zeros like the below:-

=IF(A1="","","'"&SUBSTITUTE(VALUE(LEFT(SUBSTITUTE(A1,"
",""),10))&MID(SUBSTITUTE(A1," ",""),11,255)," ",""))

OR

=IF(A1="","","'"&VALUE(LEFT(SUBSTITUTE(A1," ",""),10))&MID(SUBSTITUTE(A1,"
",""),11,255))
 
M

Ms-Exl-Learner

Hi Joe,

I have gained lot of knowledge by this post and Thanks for suggesting me
some good points.

--------------------
(Ms-Exl-Learner)
--------------------


Joe User said:
Ms-Exl-Learner said:
I don’t think so widening of columns will work if the number Exceeds 12
digits when it is formatted as General.

Correct. Well, it does not work if the number exceeds 10 digits.

In my more-complete response to the OP, I suggested combining that with
formatting as Number. Arguably, your suggestion avoids the extra step; the
column is widened automagically.

But I am seeing the same error in your below formula also,
="'"&VALUE("1234567890123456") [....]
You can notice that the end value Six will be changed into
zero after pasting the above formula in a cell.

That was the point. It is a counter-example to demonstrate that the
apostrophe does not have the desired effect when used in that way. If the
apostrophe had worked as you intended, the last 6 would not be changed to
zero.

Finally about the below formula, substituting of 0 (zero) will remove all
the zeros and result you the text numbers without any zeros.
=SUBSTITUTE(SUBSTITUTE(A1," ",""),"0","")
But the OP is looking to remove the leading zeros

You are correct. My bad.

But my point was: If the phone number might be more than 15 digits long
after removing leading zeros, then it is ill-advised to try to remove
leading zeros by converting the text to a number.


----- original message -----

Ms-Exl-Learner said:
Hi Joe,

I don’t think so widening of columns will work if the number Exceeds 12
digits when it is formatted as General. If cell is in General format and
widening of column will also result the same 1.23457E+13 error.

PS: Appending an apostrophe like that is not the same as typing an
apostrophe manually. In the case above, the apostrophe actually becomes
part
of the string, and it is displayed. I'm sure that is not what you
intended.

Yes, I though that using apostrophe in front of value function will mark
the
cell as text entry and it will show the numbers exactly even though the
length of the number goes beyond 16 digits. But now I realize that this
is
the wrong assumption.

But I am seeing the same error in your below formula also,

="'"&VALUE("1234567890123456")

Have you applied the above formula in excel? Because the Length of the
Number is exceeding 15 digits, so it will get the wrong result even though
the cell is formatted as numbers. You can notice that the end value Six
will
be changed into zero after pasting the above formula in a cell.

I think there is no benefit of using the apostrophe in front of the value
function, because Value is working with the same methodology like Number
format. Since both Number format and Value functions are showing the
correct
results when the length of the Number is upto 15 digits.

Finally about the below formula, substituting of 0 (zero) will remove all
the zeros and result you the text numbers without any zeros.

=SUBSTITUTE(SUBSTITUTE(A1," ",""),"0","")

But the OP is looking to remove the leading zeros like
00020680089005089046
to 20680089005089046. But the above formula will result 2688958946.

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top