+ Reply to Thread
Results 1 to 4 of 4

How to force LEFT function to recognize a number?

  1. #1
    Forum Contributor
    Join Date
    07-28-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    99

    How to force LEFT function to recognize a number?

    Basically I have a phone number in column A:

    123-456-1234

    In column B, I want it to show me the first 3 numbers from the left, (so 123)

    So I do =LEFT(A2,3)

    Which gives me 123, but it's displayed as text, which ruins my whole formula that looks up the area code and displays the state.

    I googled the problem and found http://exceltip.com/st/Make_LEFT_Fun...umber/778.html

    which tells me to do:
    =IF(LEFT(A1,1)=1,"Ignore",A1) [sees 1 as a number]
    =IF(LEFT(A1,1)+0=1,"Ignore",A1) [sees 1 as a number]
    =IF(LEFT(A1,1)="1","Ignore",A1) [sees 1 as text]

    but when i try that it just displays the ENTIRE phone number: 123-456-1234

    i only want the first 3.. any ideas?
    Last edited by Tommy1005; 07-29-2009 at 11:34 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to force LEFT function to recognize a number?

    Coerce the resulting string to number, a number of ways:

    =0+LEFT(A2,3)

    =--LEFT(A2,3)

    =1*LEFT(A2,3)

    =VALUE(LEFT(A2,3))

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to force LEFT function to recognize a number?

    I'm not quite sure I follow, but if you enter =left(a1,3)+0 you will get the number you want

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to force LEFT function to recognize a number?

    Darn, that's a fast donkey !

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1