Replacing characters

O

OhhAhh

I have a sheet with old phone numbers on it. The numbers all have a leading
3 (ie 3476) which I want to replace with a 0 (ie 0476). Of course if I do a
regular find and replace it will replace all 3's within the numbers not just
the leading one. Can someone out there tell me what the best way to achieve
this is.

Thanks

Graeme
 
R

Roger Govier

Hi Graeme

You say ALL numbers start with 3 and you want ALL numbers to start with 0
instead.
If this is true, and the numbers are in column A then in B1 enter
="0"&MID(A1,2,20) - assuming 20 covers the longest number you have
Copy down column B or double click the fill handle at the bottom right of
the cell.
Copy the whole of column B
Paste Special=>Values

I would not Paste over the exisiting data immediately - just in case!!!!
 
O

OhhAhh

Thanks for the info.

Roger Govier said:
Hi Graeme

You say ALL numbers start with 3 and you want ALL numbers to start with 0
instead.
If this is true, and the numbers are in column A then in B1 enter
="0"&MID(A1,2,20) - assuming 20 covers the longest number you have
Copy down column B or double click the fill handle at the bottom right of
the cell.
Copy the whole of column B
Paste Special=>Values

I would not Paste over the exisiting data immediately - just in case!!!!
 
O

OhhAhh

Thanks for the info.

R.VENKATARAMAN said:
suppose your first tel no. is in B4 use this formula in C4
=IF(LEFT(B4,1)="3","0"&RIGHT(B4,3),B4)
copy this fomula down
replaced number will be in text format and others in number format in C
you can format all C as text if required
 
B

Bob Phillips

It will, which is where it fails.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
M

Myrna Larson

But it ONLY works if the first digit is 3. If it isn't, and 3 occurs later in
the number, it will fail. Another approach if the data is numeric:

=IF(A1>2999,A1-3000,A1)
 
A

Aladin Akyurek

As noted, that was a wrong proposal. Here another, purported to be
correct...

=SUBSTITUTE(LEFT(A1),"3",0)&REPLACE(A1,1,1,"")
 

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