Home » excel » excel – Extracting or selecting the first two numbers of a cell

excel – Extracting or selecting the first two numbers of a cell

Posted by: admin May 14, 2020 Leave a comment

Questions:

I want to select the first two numbers in a cell and put them in a new column, while keeping the original cell in tact. The table below shows what the extract should look like and what the original number is.

  Extract   Number   
 --------- --------- 
       00   0000852  
       01   0163457  
       92   9287514  

I have tried using this function:

=LEFT(B2,2)

The problem is that the function returns an extract like:

  Extract   Number   
 --------- --------- 
       85   0000852  
       16   0163457  
       92   9287514 

which is excluding the preliminary zeros.

How to&Answers:

Applying a number format does not change the underlying value of the cell, it only changes how the number is displayed in that cell:

enter image description here

Even though it shows 0000852 the number stored is 852 and thus when the Left is used it references the stored not the displayed number.

You will need to use TEXT to add the leading 0s as the number stored does not have them, they are being shown by a custom number format:

=LEFT(TEXT(B2,"0000000"),2)

enter image description here