ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Adding Prefix (https://www.excelbanter.com/excel-worksheet-functions/108387-adding-prefix.html)

Freshman

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.

Toppers

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.


Leo Heuser

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.



MartinW

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



MartinW

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




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com