+ Reply to Thread
Results 1 to 5 of 5

Left function to include text beginning with 0

  1. #1
    Registered User
    Join Date
    11-15-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    2

    Left function to include text beginning with 0

    Hi,

    I'm trying to write a LEFT formula in Excel that returns the 1st 3 numbers from a 12 digit field, however if the source number begins with a "0", then LEFT,3 just gives me the 2nd, 3rd and 4th digits instead. The number i'm looking up is 075-23459012, i want the result to be 075, so that i can build an IF solution in another workbook.

    How can i improve my formula to include the 0 at the start if at all?

    Thanks

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Left function to include text beginning with 0

    if its not returning the leading zero then the cell must contain a number custom formatted 000-00000000
    so try =LEFT(TEXT(A1,"000-00000000"),3)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Left function to include text beginning with 0

    A1 cell
    075-23459012

    B1 cell
    ="'"&LEFT(A1,3)

    Change the cell reference A1 to your cell


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Left function to include text beginning with 0

    =LEFT(A1,FIND("-",A1,1)-1)

    this formula results "075" and its format is text, if it will be formatted as number 0 number will be deleted

  5. #5
    Registered User
    Join Date
    11-15-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Left function to include text beginning with 0

    Thats great guys, bit of variation, but all working fine now. Thanks

+ 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