KutoolsforOffice — One Suite. Five Tools. Get More Done.

How to show only first nth characters in a cell string?

AuthorSunLast modified

In many Excel tasks, you may need to display only the first few characters of text from a cell—for example, pulling the first 3, 5, or any specified number of characters for codes, abbreviations, or shortened identifiers. This is a common requirement when working with imported data, long strings, or when preparing summaries for reports. By isolating the initial segment of cell content, you can quickly create standardized, concise data displays and facilitate easier comparison, sorting, and data management. Here you’ll find several practical solutions for displaying only the first nth characters in a cell, adapted for different user scenarios and needs.

A screenshot showing a list of strings in Excel where only the first nth characters are displayed

Show only first nth characters with formula
Use VBA macro to extract the first nth characters from cells


arrow blue right bubble Show only first nth characters with formula

This method uses an Excel formula to extract the first n characters from a cell. For demonstration, let’s display the first 3 characters of a cell’s value. You can easily adjust the number to suit your own needs.

Select a blank cell where you want to display only the first 3 characters from another cell, and enter the following formula:

=LEFT(A1,3)

After entering the formula, press Enter. To quickly extract from multiple cells, click the cell with the formula, then drag the fill handle down over the other cells you want to process. Each cell will now show just the first 3 characters from the corresponding original cell.
A screenshot showing how the LEFT function is used in Excel to display only the first nth characters of a string

Formula explanation: LEFT(text, num_chars) extracts the first num_chars characters from text. Adjust 3 to the number of characters you want, or replace A1 with the relevant cell reference. Make sure the value in num_chars does not exceed the string length to avoid unexpected results.

Note: If your text contains spaces and you want to extract the first n non-space characters, use this formula instead:

=LEFT(SUBSTITUTE(A1," ",""),3)

This formula first removes all spaces, then extracts the first 3 characters from the resulting string. Useful for codes, serial numbers, or when uniform text structure is required.

Tip: For situations where you want to rapidly delete characters from any position (not just the start), consider Kutools for Excel’s Remove by Position utility. This feature simplifies batch character deletion, allowing you to select specific positions to remove, which is very useful for complex string cleanup tasks. Try Kutools for Excel’s free trial to explore more automated text operations.

A screenshot of Kutools for Excel’s 'Remove by Position' feature for removing characters by position in a string


Use VBA macro to extract the first nth characters from cells

For advanced users who often need to extract the first n characters from numerous cells automatically, a VBA macro offers a flexible and efficient solution. This approach is especially useful when working with large datasets, where manually entering formulas for each row is time-consuming. By running a macro, you can specify any range and customize the number of characters to extract at once.

1. Go to the Developer Tools tab in Excel and click Visual Basic. In the opened Microsoft Visual Basic for Applications window, click Insert > Module, then copy and paste the following code into the Module:

Sub ExtractFirstNCharacters()
    Dim rng As Range
    Dim WorkRng As Range
    Dim n As Integer
    Dim cell As Range
    Dim result As String
    
    On Error Resume Next
    xTitleId = "KutoolsforExcel"
    
    Set WorkRng = Application.Selection
    Set WorkRng = Application.InputBox("Select range to extract characters", xTitleId, WorkRng.Address, Type:=8)
    
    n = Application.InputBox("Enter number of characters to extract", xTitleId, "3", Type:=1)
    
    For Each cell In WorkRng
        If Len(cell.Value) >= n Then
            result = Left(cell.Value, n)
        Else
            result = cell.Value
        End If
        cell.Offset(0, 1).Value = result
    Next cell
End Sub

2. After entering the code, click the Run buttonRun button to execute the macro. Follow the prompts: first select your data range, then enter your desired character count. The macro will quickly populate the adjacent column with the extracted results.

Tips & Precautions: This VBA method works on the active worksheet’s selection. Ensure there’s a blank column next to your original data to receive the output. If your range includes formulas or non-text cells, the macro will attempt extraction but may result in unexpected output—always confirm results for accuracy. Using On Error Resume Next helps prevent code interruption in case of minor cell errors. For undo, save your work before running macros or consider duplicating your data for safety.

Application Scenarios: VBA automation is ideal for payroll lists, code formatting, product tagging, and any work requiring repeated extraction actions. It’s particularly powerful for batch processing tasks, and can be customized further for non-contiguous ranges or different output patterns.

Pros: Automates large-scale extraction with customizable parameters. Cons: Requires VBA access and basic macro security settings enabled in Excel.


Best Office Productivity Tools

🤖Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |  Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |  Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

ExcelWordOutlookTabsPowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in