How do I get the =LEFT function in excel, to also take the number zero as the first number?Need a formula that looks at the first digit or letter in a cellExcel Formula To Get First Non-Zero Value in Row and Return Column HeaderMS Excel: Count the max spaces between a number frequencyExcel Formula To Get LAST Non-Zero Value in Row and Return Column HeaderHow to find the first non-zero number from the bottom up by referenced vehicle#?How to select the first number in cell in Excel?Searching an array from bottom to topHow to get continuous number based on item number for each category in excel?Excel: lookup the last non-zero, non-empty cell in filtered range

Collect tracking code is not working properly

If Space Shuttle flies "like a brick", why does it need the wings?

Software for generating a lattice from a unit cell for molecular crystals?

Are humans superior to machines in chess?

How do you deal with someone who is nosy, projects their feelings about career, and gives unsolicited advice in that area?

Why did Magnus join Horus in his Heresy?

What's the most rewarding path?

Where and/or why is a slanted hyphen used?

What is the purpose of R1 in this circuit?

Driverless car Puzzle

Seven Pounds Eight and Eight Pence

I'm from Mumbai, India. I want to travel to Europe as a tourist but my salary is low ( €190/month)

Joining elements of a list if those elements are in between two whitespaces

Really bizarre dystopian children’s film with hundreds of young boys forced to play piano

Why would a life company agree to a 20-year guaranteed life annuity which is expected to pay out more than the principal?

What does Darth Vader think Obi-Wan's referring to when Obi says "If you strike me down..."

What are these tiny kidney bean sized things in my rotisserie chicken

Is it possible to get reverse life insurance?

Select subsets from a list based on a criterion?

Is the Summon Woodland Beings spell (to summon pixies) broken?

Christmas party and autism

90's or earlier book with a ship called Heinlein

Does a small cup of coffee result in a 45% reduced blood flow to the brain?

Why didn't Abraham ask the single best question?



How do I get the =LEFT function in excel, to also take the number zero as the first number?


Need a formula that looks at the first digit or letter in a cellExcel Formula To Get First Non-Zero Value in Row and Return Column HeaderMS Excel: Count the max spaces between a number frequencyExcel Formula To Get LAST Non-Zero Value in Row and Return Column HeaderHow to find the first non-zero number from the bottom up by referenced vehicle#?How to select the first number in cell in Excel?Searching an array from bottom to topHow to get continuous number based on item number for each category in excel?Excel: lookup the last non-zero, non-empty cell in filtered range






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









20

















My data contains a column of room numbers. Each room number's first 2 digits is the floor number where the room is located. The =LEFT function works well for data that does not start with zero. The =LEFT function doesn't work well for data that starts with zero.



How can I get the formula to not ignore the first number when it is zero?



Room Number Formula Floor Number
1214 =LEFT (A2, 2) 12
2354 =LEFT (A2, 2) 23
1876 =LEFT (A2, 2) 18
1567 =LEFT (A2, 2) 15
0403 =LEFT (A2, 2) 40* (should be level 04)
1918 =LEFT (A2, 2) 19
0910 =LEFT (A2, 2) 91* (should be level 09)









share|improve this question























  • 1





    I think we clobbered our edits together. I've code-formatted your data so it looks good.

    – Michael Frank
    Aug 6 at 3:45











  • Thanks @MichaelFrank!!

    – Jefferson
    Aug 6 at 3:46

















20

















My data contains a column of room numbers. Each room number's first 2 digits is the floor number where the room is located. The =LEFT function works well for data that does not start with zero. The =LEFT function doesn't work well for data that starts with zero.



How can I get the formula to not ignore the first number when it is zero?



Room Number Formula Floor Number
1214 =LEFT (A2, 2) 12
2354 =LEFT (A2, 2) 23
1876 =LEFT (A2, 2) 18
1567 =LEFT (A2, 2) 15
0403 =LEFT (A2, 2) 40* (should be level 04)
1918 =LEFT (A2, 2) 19
0910 =LEFT (A2, 2) 91* (should be level 09)









share|improve this question























  • 1





    I think we clobbered our edits together. I've code-formatted your data so it looks good.

    – Michael Frank
    Aug 6 at 3:45











  • Thanks @MichaelFrank!!

    – Jefferson
    Aug 6 at 3:46













20












20








20


1






My data contains a column of room numbers. Each room number's first 2 digits is the floor number where the room is located. The =LEFT function works well for data that does not start with zero. The =LEFT function doesn't work well for data that starts with zero.



How can I get the formula to not ignore the first number when it is zero?



Room Number Formula Floor Number
1214 =LEFT (A2, 2) 12
2354 =LEFT (A2, 2) 23
1876 =LEFT (A2, 2) 18
1567 =LEFT (A2, 2) 15
0403 =LEFT (A2, 2) 40* (should be level 04)
1918 =LEFT (A2, 2) 19
0910 =LEFT (A2, 2) 91* (should be level 09)









share|improve this question

















My data contains a column of room numbers. Each room number's first 2 digits is the floor number where the room is located. The =LEFT function works well for data that does not start with zero. The =LEFT function doesn't work well for data that starts with zero.



How can I get the formula to not ignore the first number when it is zero?



Room Number Formula Floor Number
1214 =LEFT (A2, 2) 12
2354 =LEFT (A2, 2) 23
1876 =LEFT (A2, 2) 18
1567 =LEFT (A2, 2) 15
0403 =LEFT (A2, 2) 40* (should be level 04)
1918 =LEFT (A2, 2) 19
0910 =LEFT (A2, 2) 91* (should be level 09)






microsoft-excel worksheet-function microsoft-excel-2010 microsoft-excel-2007






share|improve this question
















share|improve this question













share|improve this question




share|improve this question








edited Aug 6 at 3:45









Michael Frank

7,1911 gold badge33 silver badges49 bronze badges




7,1911 gold badge33 silver badges49 bronze badges










asked Aug 6 at 3:42









JeffersonJefferson

1014 bronze badges




1014 bronze badges










  • 1





    I think we clobbered our edits together. I've code-formatted your data so it looks good.

    – Michael Frank
    Aug 6 at 3:45











  • Thanks @MichaelFrank!!

    – Jefferson
    Aug 6 at 3:46












  • 1





    I think we clobbered our edits together. I've code-formatted your data so it looks good.

    – Michael Frank
    Aug 6 at 3:45











  • Thanks @MichaelFrank!!

    – Jefferson
    Aug 6 at 3:46







1




1





I think we clobbered our edits together. I've code-formatted your data so it looks good.

– Michael Frank
Aug 6 at 3:45





I think we clobbered our edits together. I've code-formatted your data so it looks good.

– Michael Frank
Aug 6 at 3:45













Thanks @MichaelFrank!!

– Jefferson
Aug 6 at 3:46





Thanks @MichaelFrank!!

– Jefferson
Aug 6 at 3:46










5 Answers
5






active

oldest

votes


















35


















If all the room numbers are meant to have 4 digits, and the four digits are achieved by formatting numbers less than 1000 with custom format "0000", then you can use



=LEFT(TEXT(A1,"0000"),2)


Edit: FWIW, this approach also works if the value is text.



enter image description here






share|improve this answer



































    26


















    It seems you store room numbers as numbers, this case LEFT is not the best choice, use INT instead:



    =INT(A2/100)



    To keep the leading zero (04 instead of 4) you need to set number format of the cells to "Custom" with "type": 00



    Thanks @fixer1234 for the comment!



    enter image description here






    share|improve this answer























    • 9





      Good answer. - I would argue that the "Room numbers" are not really numbers, but more room-identifiers and type text is appropriate. My experience as an API developer has lead me to follow this rule of thumb: "If it doesn't make sense to add or multiply it, it should probably be saved as text rather than a number" - even more true for combined keys where certain "digits" have meaning.

      – Falco
      Aug 7 at 14:13






    • 2





      This is also the QUOTIENT function: =QUOTIENT(A1,100)

      – Chronocidal
      Aug 7 at 15:54






    • 3





      @Falco Indeed, it's possible that at some point in the future, a "room number" of "1214A" will exist, and treating what is fundamentally a string as if it were a number will fail.

      – Monty Harder
      Aug 7 at 16:59











    • my approach works with strings as well as with numbers. I updated my answer with a screenshot.

      – teylyn
      Aug 8 at 0:16







    • 2





      Int he same category: phone numbers aren't numbers either.

      – MSalters
      Aug 8 at 12:27


















    6


















    This sounds like it's a cell formatting issue. Make sure your Room Number column is formatted as Text and not General or Number.



    LEFT formula example

    This is from LibreOffice, but the behaviour is the same for Excel as long as the cell is formatted as Text.



    Based on your comment that you simply custom formatted the value to show a leading 0, you can use this formula to check if there is a leading 0 on a room name and then add one if there isn't:



    =IF(LEFT(A1,1)=0,LEFT(A1,2),CONCAT("0",LEFT(A1,1)))



    Screenshot to show leading 0 logic formula in action






    share|improve this answer




























    • When I format it as text, the room number 0403 becomes 403. The =LEFT function will grab the number 40 as the floor number.

      – Jefferson
      Aug 6 at 3:49







    • 1





      You have to enter the room numbers into the cell after you format it to Text, otherwise it will have already dropped the leading 0.

      – Michael Frank
      Aug 6 at 3:50











    • When I extract the data from the system, rooms located on single digit floors is format as E.g. 405, 905. I added the custom format 0000 thinking that this will let me use the =LEFT function but the function is ignoring the zero in front of it.

      – Jefferson
      Aug 6 at 3:52






    • 1





      or just =LEFT(TEXT(A1,"0000"),2)

      – teylyn
      Aug 6 at 5:29






    • 2





      @Jefferson "When I format it as text, the room number 0403 becomes 403." - That's good! Before you formatted it as text, there was a problem (namely, the cell had the wrong contents), but the problem was hidden. Formatting it as text revealed the problem.

      – Tanner Swett
      Aug 6 at 18:38


















    6


















    Michael Frank figured out what's going on. A custom format of "0000" adds leading zeros as necessary to display four digits, but it doesn't alter what is in the cell. If you apply that format to 102, the cell will display 0102, but if you use LEN() to test the number of characters, that will show three. You can use this for a solution with a short formula.



    enter image description here



    In A1, I've got the value 102. In A2 is the same value, custom formatted 0000. The formula in B2 is:



    =LEFT(REPT("0",4-LEN(A2))&A2,2)


    This subtracts the actual length of the value in A2 from 4, then creates the resulting count of leading zeros and concatenates that to the actual value in A2. Then it takes the left two characters of the result.



    Row 3 shows the result when the value in column A is actually four characters.






    share|improve this answer




























    • Nice, a much simpler formula than my quick example. +1

      – Michael Frank
      Aug 6 at 5:03






    • 1





      or simpler: =LEFT(TEXT(A1,"0000"),2)

      – teylyn
      Aug 6 at 5:29



















    1


















    There are already good answers available to your question, but if you want to make this work with the same formula you had used initially:



    =LEFT(A1,2)


    then just prefix ' (single quote before the number). 
    See the below screenshot for your reference



    e.g., instead of just 0403, make it '0403 and then apply the same formula.



    Screenshot for reference below



    Add prefix before the number:



    Prefixed with '



    Works with the same formula:



    Works with same formula






    share|improve this answer




























    • But it should be noted that this is essentially equivalent to Michael Frank’s answer, which also allows the user to use the =LEFT(A1,2) formula and seems like it might be less work..

      – G-Man Says 'Reinstate Monica'
      Aug 8 at 21:21












    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "3"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1468068%2fhow-do-i-get-the-left-function-in-excel-to-also-take-the-number-zero-as-the-fi%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown


























    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    35


















    If all the room numbers are meant to have 4 digits, and the four digits are achieved by formatting numbers less than 1000 with custom format "0000", then you can use



    =LEFT(TEXT(A1,"0000"),2)


    Edit: FWIW, this approach also works if the value is text.



    enter image description here






    share|improve this answer
































      35


















      If all the room numbers are meant to have 4 digits, and the four digits are achieved by formatting numbers less than 1000 with custom format "0000", then you can use



      =LEFT(TEXT(A1,"0000"),2)


      Edit: FWIW, this approach also works if the value is text.



      enter image description here






      share|improve this answer






























        35














        35










        35









        If all the room numbers are meant to have 4 digits, and the four digits are achieved by formatting numbers less than 1000 with custom format "0000", then you can use



        =LEFT(TEXT(A1,"0000"),2)


        Edit: FWIW, this approach also works if the value is text.



        enter image description here






        share|improve this answer
















        If all the room numbers are meant to have 4 digits, and the four digits are achieved by formatting numbers less than 1000 with custom format "0000", then you can use



        =LEFT(TEXT(A1,"0000"),2)


        Edit: FWIW, this approach also works if the value is text.



        enter image description here







        share|improve this answer















        share|improve this answer




        share|improve this answer








        edited Aug 8 at 0:16

























        answered Aug 6 at 5:28









        teylynteylyn

        18.9k2 gold badges27 silver badges41 bronze badges




        18.9k2 gold badges27 silver badges41 bronze badges


























            26


















            It seems you store room numbers as numbers, this case LEFT is not the best choice, use INT instead:



            =INT(A2/100)



            To keep the leading zero (04 instead of 4) you need to set number format of the cells to "Custom" with "type": 00



            Thanks @fixer1234 for the comment!



            enter image description here






            share|improve this answer























            • 9





              Good answer. - I would argue that the "Room numbers" are not really numbers, but more room-identifiers and type text is appropriate. My experience as an API developer has lead me to follow this rule of thumb: "If it doesn't make sense to add or multiply it, it should probably be saved as text rather than a number" - even more true for combined keys where certain "digits" have meaning.

              – Falco
              Aug 7 at 14:13






            • 2





              This is also the QUOTIENT function: =QUOTIENT(A1,100)

              – Chronocidal
              Aug 7 at 15:54






            • 3





              @Falco Indeed, it's possible that at some point in the future, a "room number" of "1214A" will exist, and treating what is fundamentally a string as if it were a number will fail.

              – Monty Harder
              Aug 7 at 16:59











            • my approach works with strings as well as with numbers. I updated my answer with a screenshot.

              – teylyn
              Aug 8 at 0:16







            • 2





              Int he same category: phone numbers aren't numbers either.

              – MSalters
              Aug 8 at 12:27















            26


















            It seems you store room numbers as numbers, this case LEFT is not the best choice, use INT instead:



            =INT(A2/100)



            To keep the leading zero (04 instead of 4) you need to set number format of the cells to "Custom" with "type": 00



            Thanks @fixer1234 for the comment!



            enter image description here






            share|improve this answer























            • 9





              Good answer. - I would argue that the "Room numbers" are not really numbers, but more room-identifiers and type text is appropriate. My experience as an API developer has lead me to follow this rule of thumb: "If it doesn't make sense to add or multiply it, it should probably be saved as text rather than a number" - even more true for combined keys where certain "digits" have meaning.

              – Falco
              Aug 7 at 14:13






            • 2





              This is also the QUOTIENT function: =QUOTIENT(A1,100)

              – Chronocidal
              Aug 7 at 15:54






            • 3





              @Falco Indeed, it's possible that at some point in the future, a "room number" of "1214A" will exist, and treating what is fundamentally a string as if it were a number will fail.

              – Monty Harder
              Aug 7 at 16:59











            • my approach works with strings as well as with numbers. I updated my answer with a screenshot.

              – teylyn
              Aug 8 at 0:16







            • 2





              Int he same category: phone numbers aren't numbers either.

              – MSalters
              Aug 8 at 12:27













            26














            26










            26









            It seems you store room numbers as numbers, this case LEFT is not the best choice, use INT instead:



            =INT(A2/100)



            To keep the leading zero (04 instead of 4) you need to set number format of the cells to "Custom" with "type": 00



            Thanks @fixer1234 for the comment!



            enter image description here






            share|improve this answer
















            It seems you store room numbers as numbers, this case LEFT is not the best choice, use INT instead:



            =INT(A2/100)



            To keep the leading zero (04 instead of 4) you need to set number format of the cells to "Custom" with "type": 00



            Thanks @fixer1234 for the comment!



            enter image description here







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Aug 6 at 10:47

























            answered Aug 6 at 5:44









            Máté JuhászMáté Juhász

            16.2k6 gold badges37 silver badges55 bronze badges




            16.2k6 gold badges37 silver badges55 bronze badges










            • 9





              Good answer. - I would argue that the "Room numbers" are not really numbers, but more room-identifiers and type text is appropriate. My experience as an API developer has lead me to follow this rule of thumb: "If it doesn't make sense to add or multiply it, it should probably be saved as text rather than a number" - even more true for combined keys where certain "digits" have meaning.

              – Falco
              Aug 7 at 14:13






            • 2





              This is also the QUOTIENT function: =QUOTIENT(A1,100)

              – Chronocidal
              Aug 7 at 15:54






            • 3





              @Falco Indeed, it's possible that at some point in the future, a "room number" of "1214A" will exist, and treating what is fundamentally a string as if it were a number will fail.

              – Monty Harder
              Aug 7 at 16:59











            • my approach works with strings as well as with numbers. I updated my answer with a screenshot.

              – teylyn
              Aug 8 at 0:16







            • 2





              Int he same category: phone numbers aren't numbers either.

              – MSalters
              Aug 8 at 12:27












            • 9





              Good answer. - I would argue that the "Room numbers" are not really numbers, but more room-identifiers and type text is appropriate. My experience as an API developer has lead me to follow this rule of thumb: "If it doesn't make sense to add or multiply it, it should probably be saved as text rather than a number" - even more true for combined keys where certain "digits" have meaning.

              – Falco
              Aug 7 at 14:13






            • 2





              This is also the QUOTIENT function: =QUOTIENT(A1,100)

              – Chronocidal
              Aug 7 at 15:54






            • 3





              @Falco Indeed, it's possible that at some point in the future, a "room number" of "1214A" will exist, and treating what is fundamentally a string as if it were a number will fail.

              – Monty Harder
              Aug 7 at 16:59











            • my approach works with strings as well as with numbers. I updated my answer with a screenshot.

              – teylyn
              Aug 8 at 0:16







            • 2





              Int he same category: phone numbers aren't numbers either.

              – MSalters
              Aug 8 at 12:27







            9




            9





            Good answer. - I would argue that the "Room numbers" are not really numbers, but more room-identifiers and type text is appropriate. My experience as an API developer has lead me to follow this rule of thumb: "If it doesn't make sense to add or multiply it, it should probably be saved as text rather than a number" - even more true for combined keys where certain "digits" have meaning.

            – Falco
            Aug 7 at 14:13





            Good answer. - I would argue that the "Room numbers" are not really numbers, but more room-identifiers and type text is appropriate. My experience as an API developer has lead me to follow this rule of thumb: "If it doesn't make sense to add or multiply it, it should probably be saved as text rather than a number" - even more true for combined keys where certain "digits" have meaning.

            – Falco
            Aug 7 at 14:13




            2




            2





            This is also the QUOTIENT function: =QUOTIENT(A1,100)

            – Chronocidal
            Aug 7 at 15:54





            This is also the QUOTIENT function: =QUOTIENT(A1,100)

            – Chronocidal
            Aug 7 at 15:54




            3




            3





            @Falco Indeed, it's possible that at some point in the future, a "room number" of "1214A" will exist, and treating what is fundamentally a string as if it were a number will fail.

            – Monty Harder
            Aug 7 at 16:59





            @Falco Indeed, it's possible that at some point in the future, a "room number" of "1214A" will exist, and treating what is fundamentally a string as if it were a number will fail.

            – Monty Harder
            Aug 7 at 16:59













            my approach works with strings as well as with numbers. I updated my answer with a screenshot.

            – teylyn
            Aug 8 at 0:16






            my approach works with strings as well as with numbers. I updated my answer with a screenshot.

            – teylyn
            Aug 8 at 0:16





            2




            2





            Int he same category: phone numbers aren't numbers either.

            – MSalters
            Aug 8 at 12:27





            Int he same category: phone numbers aren't numbers either.

            – MSalters
            Aug 8 at 12:27











            6


















            This sounds like it's a cell formatting issue. Make sure your Room Number column is formatted as Text and not General or Number.



            LEFT formula example

            This is from LibreOffice, but the behaviour is the same for Excel as long as the cell is formatted as Text.



            Based on your comment that you simply custom formatted the value to show a leading 0, you can use this formula to check if there is a leading 0 on a room name and then add one if there isn't:



            =IF(LEFT(A1,1)=0,LEFT(A1,2),CONCAT("0",LEFT(A1,1)))



            Screenshot to show leading 0 logic formula in action






            share|improve this answer




























            • When I format it as text, the room number 0403 becomes 403. The =LEFT function will grab the number 40 as the floor number.

              – Jefferson
              Aug 6 at 3:49







            • 1





              You have to enter the room numbers into the cell after you format it to Text, otherwise it will have already dropped the leading 0.

              – Michael Frank
              Aug 6 at 3:50











            • When I extract the data from the system, rooms located on single digit floors is format as E.g. 405, 905. I added the custom format 0000 thinking that this will let me use the =LEFT function but the function is ignoring the zero in front of it.

              – Jefferson
              Aug 6 at 3:52






            • 1





              or just =LEFT(TEXT(A1,"0000"),2)

              – teylyn
              Aug 6 at 5:29






            • 2





              @Jefferson "When I format it as text, the room number 0403 becomes 403." - That's good! Before you formatted it as text, there was a problem (namely, the cell had the wrong contents), but the problem was hidden. Formatting it as text revealed the problem.

              – Tanner Swett
              Aug 6 at 18:38















            6


















            This sounds like it's a cell formatting issue. Make sure your Room Number column is formatted as Text and not General or Number.



            LEFT formula example

            This is from LibreOffice, but the behaviour is the same for Excel as long as the cell is formatted as Text.



            Based on your comment that you simply custom formatted the value to show a leading 0, you can use this formula to check if there is a leading 0 on a room name and then add one if there isn't:



            =IF(LEFT(A1,1)=0,LEFT(A1,2),CONCAT("0",LEFT(A1,1)))



            Screenshot to show leading 0 logic formula in action






            share|improve this answer




























            • When I format it as text, the room number 0403 becomes 403. The =LEFT function will grab the number 40 as the floor number.

              – Jefferson
              Aug 6 at 3:49







            • 1





              You have to enter the room numbers into the cell after you format it to Text, otherwise it will have already dropped the leading 0.

              – Michael Frank
              Aug 6 at 3:50











            • When I extract the data from the system, rooms located on single digit floors is format as E.g. 405, 905. I added the custom format 0000 thinking that this will let me use the =LEFT function but the function is ignoring the zero in front of it.

              – Jefferson
              Aug 6 at 3:52






            • 1





              or just =LEFT(TEXT(A1,"0000"),2)

              – teylyn
              Aug 6 at 5:29






            • 2





              @Jefferson "When I format it as text, the room number 0403 becomes 403." - That's good! Before you formatted it as text, there was a problem (namely, the cell had the wrong contents), but the problem was hidden. Formatting it as text revealed the problem.

              – Tanner Swett
              Aug 6 at 18:38













            6














            6










            6









            This sounds like it's a cell formatting issue. Make sure your Room Number column is formatted as Text and not General or Number.



            LEFT formula example

            This is from LibreOffice, but the behaviour is the same for Excel as long as the cell is formatted as Text.



            Based on your comment that you simply custom formatted the value to show a leading 0, you can use this formula to check if there is a leading 0 on a room name and then add one if there isn't:



            =IF(LEFT(A1,1)=0,LEFT(A1,2),CONCAT("0",LEFT(A1,1)))



            Screenshot to show leading 0 logic formula in action






            share|improve this answer
















            This sounds like it's a cell formatting issue. Make sure your Room Number column is formatted as Text and not General or Number.



            LEFT formula example

            This is from LibreOffice, but the behaviour is the same for Excel as long as the cell is formatted as Text.



            Based on your comment that you simply custom formatted the value to show a leading 0, you can use this formula to check if there is a leading 0 on a room name and then add one if there isn't:



            =IF(LEFT(A1,1)=0,LEFT(A1,2),CONCAT("0",LEFT(A1,1)))



            Screenshot to show leading 0 logic formula in action







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Aug 6 at 3:59

























            answered Aug 6 at 3:47









            Michael FrankMichael Frank

            7,1911 gold badge33 silver badges49 bronze badges




            7,1911 gold badge33 silver badges49 bronze badges















            • When I format it as text, the room number 0403 becomes 403. The =LEFT function will grab the number 40 as the floor number.

              – Jefferson
              Aug 6 at 3:49







            • 1





              You have to enter the room numbers into the cell after you format it to Text, otherwise it will have already dropped the leading 0.

              – Michael Frank
              Aug 6 at 3:50











            • When I extract the data from the system, rooms located on single digit floors is format as E.g. 405, 905. I added the custom format 0000 thinking that this will let me use the =LEFT function but the function is ignoring the zero in front of it.

              – Jefferson
              Aug 6 at 3:52






            • 1





              or just =LEFT(TEXT(A1,"0000"),2)

              – teylyn
              Aug 6 at 5:29






            • 2





              @Jefferson "When I format it as text, the room number 0403 becomes 403." - That's good! Before you formatted it as text, there was a problem (namely, the cell had the wrong contents), but the problem was hidden. Formatting it as text revealed the problem.

              – Tanner Swett
              Aug 6 at 18:38

















            • When I format it as text, the room number 0403 becomes 403. The =LEFT function will grab the number 40 as the floor number.

              – Jefferson
              Aug 6 at 3:49







            • 1





              You have to enter the room numbers into the cell after you format it to Text, otherwise it will have already dropped the leading 0.

              – Michael Frank
              Aug 6 at 3:50











            • When I extract the data from the system, rooms located on single digit floors is format as E.g. 405, 905. I added the custom format 0000 thinking that this will let me use the =LEFT function but the function is ignoring the zero in front of it.

              – Jefferson
              Aug 6 at 3:52






            • 1





              or just =LEFT(TEXT(A1,"0000"),2)

              – teylyn
              Aug 6 at 5:29






            • 2





              @Jefferson "When I format it as text, the room number 0403 becomes 403." - That's good! Before you formatted it as text, there was a problem (namely, the cell had the wrong contents), but the problem was hidden. Formatting it as text revealed the problem.

              – Tanner Swett
              Aug 6 at 18:38
















            When I format it as text, the room number 0403 becomes 403. The =LEFT function will grab the number 40 as the floor number.

            – Jefferson
            Aug 6 at 3:49






            When I format it as text, the room number 0403 becomes 403. The =LEFT function will grab the number 40 as the floor number.

            – Jefferson
            Aug 6 at 3:49





            1




            1





            You have to enter the room numbers into the cell after you format it to Text, otherwise it will have already dropped the leading 0.

            – Michael Frank
            Aug 6 at 3:50





            You have to enter the room numbers into the cell after you format it to Text, otherwise it will have already dropped the leading 0.

            – Michael Frank
            Aug 6 at 3:50













            When I extract the data from the system, rooms located on single digit floors is format as E.g. 405, 905. I added the custom format 0000 thinking that this will let me use the =LEFT function but the function is ignoring the zero in front of it.

            – Jefferson
            Aug 6 at 3:52





            When I extract the data from the system, rooms located on single digit floors is format as E.g. 405, 905. I added the custom format 0000 thinking that this will let me use the =LEFT function but the function is ignoring the zero in front of it.

            – Jefferson
            Aug 6 at 3:52




            1




            1





            or just =LEFT(TEXT(A1,"0000"),2)

            – teylyn
            Aug 6 at 5:29





            or just =LEFT(TEXT(A1,"0000"),2)

            – teylyn
            Aug 6 at 5:29




            2




            2





            @Jefferson "When I format it as text, the room number 0403 becomes 403." - That's good! Before you formatted it as text, there was a problem (namely, the cell had the wrong contents), but the problem was hidden. Formatting it as text revealed the problem.

            – Tanner Swett
            Aug 6 at 18:38





            @Jefferson "When I format it as text, the room number 0403 becomes 403." - That's good! Before you formatted it as text, there was a problem (namely, the cell had the wrong contents), but the problem was hidden. Formatting it as text revealed the problem.

            – Tanner Swett
            Aug 6 at 18:38











            6


















            Michael Frank figured out what's going on. A custom format of "0000" adds leading zeros as necessary to display four digits, but it doesn't alter what is in the cell. If you apply that format to 102, the cell will display 0102, but if you use LEN() to test the number of characters, that will show three. You can use this for a solution with a short formula.



            enter image description here



            In A1, I've got the value 102. In A2 is the same value, custom formatted 0000. The formula in B2 is:



            =LEFT(REPT("0",4-LEN(A2))&A2,2)


            This subtracts the actual length of the value in A2 from 4, then creates the resulting count of leading zeros and concatenates that to the actual value in A2. Then it takes the left two characters of the result.



            Row 3 shows the result when the value in column A is actually four characters.






            share|improve this answer




























            • Nice, a much simpler formula than my quick example. +1

              – Michael Frank
              Aug 6 at 5:03






            • 1





              or simpler: =LEFT(TEXT(A1,"0000"),2)

              – teylyn
              Aug 6 at 5:29
















            6


















            Michael Frank figured out what's going on. A custom format of "0000" adds leading zeros as necessary to display four digits, but it doesn't alter what is in the cell. If you apply that format to 102, the cell will display 0102, but if you use LEN() to test the number of characters, that will show three. You can use this for a solution with a short formula.



            enter image description here



            In A1, I've got the value 102. In A2 is the same value, custom formatted 0000. The formula in B2 is:



            =LEFT(REPT("0",4-LEN(A2))&A2,2)


            This subtracts the actual length of the value in A2 from 4, then creates the resulting count of leading zeros and concatenates that to the actual value in A2. Then it takes the left two characters of the result.



            Row 3 shows the result when the value in column A is actually four characters.






            share|improve this answer




























            • Nice, a much simpler formula than my quick example. +1

              – Michael Frank
              Aug 6 at 5:03






            • 1





              or simpler: =LEFT(TEXT(A1,"0000"),2)

              – teylyn
              Aug 6 at 5:29














            6














            6










            6









            Michael Frank figured out what's going on. A custom format of "0000" adds leading zeros as necessary to display four digits, but it doesn't alter what is in the cell. If you apply that format to 102, the cell will display 0102, but if you use LEN() to test the number of characters, that will show three. You can use this for a solution with a short formula.



            enter image description here



            In A1, I've got the value 102. In A2 is the same value, custom formatted 0000. The formula in B2 is:



            =LEFT(REPT("0",4-LEN(A2))&A2,2)


            This subtracts the actual length of the value in A2 from 4, then creates the resulting count of leading zeros and concatenates that to the actual value in A2. Then it takes the left two characters of the result.



            Row 3 shows the result when the value in column A is actually four characters.






            share|improve this answer
















            Michael Frank figured out what's going on. A custom format of "0000" adds leading zeros as necessary to display four digits, but it doesn't alter what is in the cell. If you apply that format to 102, the cell will display 0102, but if you use LEN() to test the number of characters, that will show three. You can use this for a solution with a short formula.



            enter image description here



            In A1, I've got the value 102. In A2 is the same value, custom formatted 0000. The formula in B2 is:



            =LEFT(REPT("0",4-LEN(A2))&A2,2)


            This subtracts the actual length of the value in A2 from 4, then creates the resulting count of leading zeros and concatenates that to the actual value in A2. Then it takes the left two characters of the result.



            Row 3 shows the result when the value in column A is actually four characters.







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Aug 6 at 5:02

























            answered Aug 6 at 4:53









            fixer1234fixer1234

            22.8k15 gold badges59 silver badges91 bronze badges




            22.8k15 gold badges59 silver badges91 bronze badges















            • Nice, a much simpler formula than my quick example. +1

              – Michael Frank
              Aug 6 at 5:03






            • 1





              or simpler: =LEFT(TEXT(A1,"0000"),2)

              – teylyn
              Aug 6 at 5:29


















            • Nice, a much simpler formula than my quick example. +1

              – Michael Frank
              Aug 6 at 5:03






            • 1





              or simpler: =LEFT(TEXT(A1,"0000"),2)

              – teylyn
              Aug 6 at 5:29

















            Nice, a much simpler formula than my quick example. +1

            – Michael Frank
            Aug 6 at 5:03





            Nice, a much simpler formula than my quick example. +1

            – Michael Frank
            Aug 6 at 5:03




            1




            1





            or simpler: =LEFT(TEXT(A1,"0000"),2)

            – teylyn
            Aug 6 at 5:29






            or simpler: =LEFT(TEXT(A1,"0000"),2)

            – teylyn
            Aug 6 at 5:29












            1


















            There are already good answers available to your question, but if you want to make this work with the same formula you had used initially:



            =LEFT(A1,2)


            then just prefix ' (single quote before the number). 
            See the below screenshot for your reference



            e.g., instead of just 0403, make it '0403 and then apply the same formula.



            Screenshot for reference below



            Add prefix before the number:



            Prefixed with '



            Works with the same formula:



            Works with same formula






            share|improve this answer




























            • But it should be noted that this is essentially equivalent to Michael Frank’s answer, which also allows the user to use the =LEFT(A1,2) formula and seems like it might be less work..

              – G-Man Says 'Reinstate Monica'
              Aug 8 at 21:21















            1


















            There are already good answers available to your question, but if you want to make this work with the same formula you had used initially:



            =LEFT(A1,2)


            then just prefix ' (single quote before the number). 
            See the below screenshot for your reference



            e.g., instead of just 0403, make it '0403 and then apply the same formula.



            Screenshot for reference below



            Add prefix before the number:



            Prefixed with '



            Works with the same formula:



            Works with same formula






            share|improve this answer




























            • But it should be noted that this is essentially equivalent to Michael Frank’s answer, which also allows the user to use the =LEFT(A1,2) formula and seems like it might be less work..

              – G-Man Says 'Reinstate Monica'
              Aug 8 at 21:21













            1














            1










            1









            There are already good answers available to your question, but if you want to make this work with the same formula you had used initially:



            =LEFT(A1,2)


            then just prefix ' (single quote before the number). 
            See the below screenshot for your reference



            e.g., instead of just 0403, make it '0403 and then apply the same formula.



            Screenshot for reference below



            Add prefix before the number:



            Prefixed with '



            Works with the same formula:



            Works with same formula






            share|improve this answer
















            There are already good answers available to your question, but if you want to make this work with the same formula you had used initially:



            =LEFT(A1,2)


            then just prefix ' (single quote before the number). 
            See the below screenshot for your reference



            e.g., instead of just 0403, make it '0403 and then apply the same formula.



            Screenshot for reference below



            Add prefix before the number:



            Prefixed with '



            Works with the same formula:



            Works with same formula







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Aug 8 at 14:56









            G-Man Says 'Reinstate Monica'

            6,39711 gold badges27 silver badges65 bronze badges




            6,39711 gold badges27 silver badges65 bronze badges










            answered Aug 8 at 12:11









            Subin_LearnerSubin_Learner

            112 bronze badges




            112 bronze badges















            • But it should be noted that this is essentially equivalent to Michael Frank’s answer, which also allows the user to use the =LEFT(A1,2) formula and seems like it might be less work..

              – G-Man Says 'Reinstate Monica'
              Aug 8 at 21:21

















            • But it should be noted that this is essentially equivalent to Michael Frank’s answer, which also allows the user to use the =LEFT(A1,2) formula and seems like it might be less work..

              – G-Man Says 'Reinstate Monica'
              Aug 8 at 21:21
















            But it should be noted that this is essentially equivalent to Michael Frank’s answer, which also allows the user to use the =LEFT(A1,2) formula and seems like it might be less work..

            – G-Man Says 'Reinstate Monica'
            Aug 8 at 21:21





            But it should be noted that this is essentially equivalent to Michael Frank’s answer, which also allows the user to use the =LEFT(A1,2) formula and seems like it might be less work..

            – G-Man Says 'Reinstate Monica'
            Aug 8 at 21:21


















            draft saved

            draft discarded















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1468068%2fhow-do-i-get-the-left-function-in-excel-to-also-take-the-number-zero-as-the-fi%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown









            Popular posts from this blog

            Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

            How to get a smooth, uniform ParametricPlot of a 2D Region?How to plot a complicated Region?How to exclude a region from ParametricPlotHow discretize a region placing vertices on a specific non-uniform gridHow to transform a Plot or a ParametricPlot into a RegionHow can I get a smooth plot of a bounded region?Smooth ParametricPlot3D with RegionFunction?Smooth border of a region ParametricPlotSmooth region boundarySmooth region plot from list of pointsGet minimum y of a certain x in a region

            Genealogie vun de Merowenger Vum Merowech bis zum Chilperich I. | Navigatiounsmenü