Note: The other languages of the website are Google-translated. Back to English

Excel Formula: Trim text to n words

This tutorial introduces a formula which combine LEFT, FIND and SUBSTITUTE functions to extract first n words from a long string in Excel cell, and also explains how to use the formula.
doc abbreviate words 1

Generic formula:

=LEFT(txt,FIND("~",SUBSTITUTE(txt," ","~",n))-1)


txt: the text string or cell you want to trim.
N: the number of words you want to extract from left side of the given text string.

How this formula work

Take an instance, you want to extract part of words from left side in each cell of range B3:B6 to D3:D6, the number of words decided by the value in C3:C6. Please use below formula in D3.

=LEFT(B3,FIND("~",SUBSTITUTE(B3," ","~",C3))-1)

Press Enter key, then drag fill handle down to D6.
doc trim n words 2


SUBSTITUTE function: this function replaces a specific text with another one. Here, using this formula SUBSTITUTE(B3," ","~",C3) to replace space “ “ to “~” in the nth position.
doc trim n words 3

FIND function: to get the location of a specific text. Here FIND("~",SUBSTITUTE(B3," ","~",C3) finds the location of “~” in B3.
doc trim n words 4

LEFT function: this function is used to extract text from left side of a given text string. Here the formula LEFT(B3,FIND("~",SUBSTITUTE(B3," ","~",C3))-1) can be seen as LEFT(B3,54-1) which will extract 53 characters from left side of the text in cell B3.
doc trim n words 5

Sample File

doc sampleClick to download sample file

Relative Formulas

Relative Functions

  • SUBSTITUTE function
    Replace a text in a specific position with another one.
  • FIND function
    Find the location of a character in the text string.
  • LEFT function
    Extract part of text from left side.
  • MID
    Return the specific characters from the middle of text string.

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet

Follow Us

Copyright © 2009 - | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL