#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Adding Prefix

Dear all,

Suppose I want to input an extension number (e.g. 61151) in cell A1 then I
want a full telephone number appears in B1. Our telephone prefix is 4255 so
the full telephone number should be 4255 1151. My formula in B1 is:

=IF(LEFT(A1)=6,"4255"&RIGHT(A1,4),"")

Why I use LEFT(A1)=6 becuase I have another set of extension numbers start
with 4. However, the result of the above formula returns a blank cell. Where
is the mistake? Please kindly advise.

Thanks & regards.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default Adding Prefix

If telephone numbers are text, try:

=IF(LEFT(A1)="6","4255"& RIGHT(A1,4),"")


"Freshman" wrote:

Dear all,

Suppose I want to input an extension number (e.g. 61151) in cell A1 then I
want a full telephone number appears in B1. Our telephone prefix is 4255 so
the full telephone number should be 4255 1151. My formula in B1 is:

=IF(LEFT(A1)=6,"4255"&RIGHT(A1,4),"")

Why I use LEFT(A1)=6 becuase I have another set of extension numbers start
with 4. However, the result of the above formula returns a blank cell. Where
is the mistake? Please kindly advise.

Thanks & regards.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 266
Default Adding Prefix

"Freshman" skrev i en meddelelse
...
Dear all,

Suppose I want to input an extension number (e.g. 61151) in cell A1 then I
want a full telephone number appears in B1. Our telephone prefix is 4255
so
the full telephone number should be 4255 1151. My formula in B1 is:

=IF(LEFT(A1)=6,"4255"&RIGHT(A1,4),"")

Why I use LEFT(A1)=6 becuase I have another set of extension numbers start
with 4. However, the result of the above formula returns a blank cell.
Where
is the mistake? Please kindly advise.

Thanks & regards.


The function LEFT() always returns a string, so you can use

=IF(VALUE(LEFT(A1))=6,"4255"&RIGHT(A1,4),"")
or
=IF(LEFT(A1)="6","4255"&RIGHT(A1,4),"")


--
Best regards
Leo Heuser

Followup to newsgroup only please.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 860
Default Adding Prefix


Hi Freshman,

Your LEFT formula is missing the number of digits.

So
=IF(LEFT(A1)=6,"4255"&RIGHT(A1,4),"")
Should be
=IF(LEFT(A1,1)=6,"4255"&RIGHT(A1,4),"")

HTH
Martin


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 860
Default Adding Prefix

Ignore this post, I forgot to engage brain before typing. ;-)


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a prefix to cells PaulPA Excel Discussion (Misc queries) 2 July 17th 06 08:28 PM
Adding a prefix to all numbers in a column. Randy Excel Discussion (Misc queries) 2 February 5th 06 08:11 AM
adding the same prefix or suffix to a range of cells Betty Turvy Excel Discussion (Misc queries) 5 July 12th 05 05:13 PM
Adding zero prefix to no's Cheryl W Excel Discussion (Misc queries) 4 May 31st 05 02:35 AM
Adding a prefix to a cell by using a formula Audrey in OHIO Excel Discussion (Misc queries) 4 February 24th 05 04:49 PM


All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"