How to Use the Excel Formula to Get the First 3 Characters from a Cell: 6 Methods

Below is a dataset of the order information for a particular product. There are 3 columns: Order ID, Brand, and Price.

Overview of extracting only the first 3 character from cell B4

Note: Use the Excel 365 edition to avoid compatibility issues.

Sample Dataset


Method 1 – Using the LEFT Function to Get the First 3 Characters from a Cell

STEPS:

  • Select cell E4.
  • Enter the following formula in the Formula Bar:
=LEFT(B4,3)
  • In the LEFT function, I selected cell B4 as text and the num_chars 3. The first 3 characters from the left will be extracted.
  • Press ENTER.
  • You will see the extracted 3 characters in the Order Number column.

Using LEFT Function to Get First 3 Characters from a Cell

  • You can use the Fill Handle to AutoFill the formula in the rest of the cells.

Dragging the Fill Handle to cell E12 to get the order number value in the range of cell E4:E12

Read More: How to Extract Data from Excel Sheet


Method 2 – Applying LEFT with the SEARCH Function to Extract the First 3 Characters

STEPS:

  • Select cell E4.
  • Enter the following formula in the selected cell or Formula Bar.
=LEFT(B4,SEARCH("_",B4)-1)
  • In the SEARCH function, given (_) in find_text, then within_text, I selected cell B4. The SEARCH function will give the position number of the given text, and then 1 will be subtracted from the position. It will work as num_chars for LEFT. The LEFT function will extract the characters from the left.
  • Press ENTER.
    You will see the extracted 3 characters in the Order Number column.

Using LEFT with SEARCH Function to Get First 3 Characters

  • Use the Fill Handle to AutoFill the formula in the other cells.

Pulling the fill handle to cell E12 to extract the first 3 letter of the order ID.

Note: Use LEFT with the FIND function for case-sensitive issues.

You can also use the LEFT function with the FIND function to get the first 3 characters from the left if you want to extract value from a particular text and a special character.

STEPS:

  • Select cell E4.
  • Enter the following formula in the selected cell or Formula Bar:
=LEFT(B4,FIND("_",B4)-1)
  • In the FIND function, given (_) in find_text, then within_text, I selected cell B4. The FIND function will show the position number of the given text, and then 1 will be subtracted from the position. It will work as num_chars for LEFT. The LEFT function will extract the characters from the left.
  • Press ENTER.
  • You will see the extracted 3 characters in the Order Number column.

Using LEFT with FIND Function to Get First 3 Characters

NOTE: If you want, you can use the VALUE function here to convert the text string to numeric value by following the method explained in Using LEFT with VALUE section.
  • Use the Fill Handle to AutoFill the formula in the other cells.

Fill Handle pulled along to cell C12 to get the desired no of characters.

Read More: How to Extract Data from Cell in Excel


Method 3 – Applying the MID Function for the First 3 Characters From a Cell

STEPS:

  • Select cell
  • Enter the following formula in the selected cell or Formula Bar:
=MID(B4,1,3)
  • In the MID function, I selected cell B4 as text, start_num 1, and num_chars 3. The MID function will extract the characters starting from the 1st character to the 3rd character.
  • Press ENTER.
  • You will see the extracted 3 characters in the Order Number column.

Using MID Function to Get First 3 Characters

  • Use the Fill Handle to AutoFill the formula in the other cells.

Use of the autofill feature to automatically to deduce only the first part of the order_id

To get the results in text format, use MID with the VALUE Function.

Read More: How to Extract Data from a List Using Excel Formula


Method 4 – Getting the First 3 Characters from a Cell Through Excel VBA

STEPS:

  • Open the Developer tab >> select Visual Basic.

Using VBA to Get First 3 Characters from a Cell

  • It will open a new window of Microsoft Visual Basic for Applications.
  • Go to Insert >> select Module.

Inserting module in the visual code editor

  • Enter the code in the Module.
Sub Get_First_3Character()
Dim R As Integer
For R = 4 To 12
   ActiveSheet.Cells(R, 5).Value = Left(Cells(R, 2), 3)
Next R
End Sub

Inserting Code inside the code editor

  • Here R represents the row numbers.
  • In the LEFT function the num_chars = 3.
  • Used a For loop to continue the process for the row range.
  • Save the code and go back to the worksheet.
  • Select cell C6.
  • Open the View tab >> from Macros >> select View Macro.

Run view maros command from the view tab to see available macro in the sheet

  • A dialog box will pop up. Select the Macro to Run.

Run appropriate macro from the Macro dialog box

  • From the dialog box select the Macro name Get_First_3Character.
  • You will see the character from the used row range in VBA is extracted in the column.

Utilizing the autofill feature to fill the range of cell E4:E12 with order number


Method 5 – Utilizing Flash Fill to Return the First 3 Characters from a Cell

STEPS:

  • Enter the pattern of the first 3 characters from cell B4.

Using Flash Fill to Get First 3 Characters

  • Open the Data tab >> from Data Tools >> select Flash Fill.

go to Flash fill from the data tab to flash fill values in column

  • All the remaining cells of the Order Number will be filled with 3 characters from the Order ID column.

utilizing the autofill feature to extract the order number from the order_id

Read More: How to Extract Specific Data from a Cell in Excel


Method 6 – Extracting the First 3 Characters from a Cell with the Text to Columns Feature

a) Using Delimited

STEPS:

  • Select the B4:B12 cell range to split
  • Open the Data tab >> from Data Tools >> select Text to Columns.

Using Text to Columns with delimited to Get First 3 Characters from a Cell

  • A dialog box will pop up. Select the file type Delimited and click Next.

choose delimieted from the original data type

  • In the dialog box select the Delimiters your value has.
  • Click Next.

choose others as the delimiters

  • In the dialog box select the Delimiters your value has.
  • Click Next.

select destination of the exported text

  • A warning message will pop up. Click OK.

warnign about whether we want to replace the parent data or not

  • You will see the first 3 characters in the Order Number column.

Output values after running the VBA macro


b) Using Fixed Width

STEPS:

  • Select the cell or range of cells that you want to split.
  • Open the Data tab >> from Data Tools >> select Text to Columns.

Converting order id text to column using the Text to Column feature

  • A dialog box will pop up. Select the file type Fixed Width and click Next.

set the width of the data being exported

  • In the dialog box create a break in the line. To do that, click on the desired position.
  • Click Next.

Dialog box showing the data preview

  • You can choose the Destination or keep it as is.

selection of the destination cell for exportation of the extracted values

  • Click Finish.

clicking on finish after finishing all the set ups

  • A warning message will pop up. Click OK.

warning about whether we want to replace data or not

  • You will see the first 3 characters in the Order Number column.

output after running the text to column feature


Practice Section

Here’s a practice sheet you can use to practice these methods:

Practice Sheet where you can implement you learning


Download to Practice


Related Articles

<< Go Back To Extract Data Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Shamima Sultana
Shamima Sultana

Shamima Sultana, BSc, Computer Science and Engineering, East West University, Bangladesh, has been working with the ExcelDemy project for 2 years. She has written over 75+ articles and reviewed 1000+ articles for ExcelDemy. She has also led several teams with Excel VBA and Content Development works. Currently, she is working as the Project Manager and oversees the day-to-day work, leads the services team, allocates resources to the right area, etc. Her work and learning interests vary from Microsoft... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo