So, for example, with the text string "one two three" the result is going to look like this:
With hyphens representing spaces for readability. Keep in mind that there will be 100 spaces between each word.
Next, the RIGHT function extracts 100 characters, starting from the right. The result will look like this:
Finally, the TRIM function removes all leading spaces, and returns the last word.
Note: We are using 100 arbitrarily because that should be a big enough number to handle very long words. If you have some odd situation with super long words, bump this number up as needed.
Handling inconsistent spacing
If the text you are working with has inconsistent spacing (i.e. extra spaces between words, extra leading or trailing spaces, etc.) This formula won't work correctly. To handle this situation, add an extra TRIM function inside the substitute function like so:
If you need to get the nth word in a text string (i.e. a sentence, phrase, or paragraph) you can so with a clever (and intimidating) formula that combines 5 Excel functions: TRIM, MID, SUBSTITUTE, REPT, and LEN. How this formula works At the core,...
If you need to extract the first word from some text you can use a formula that uses the FIND and LEFT functions. From the example, the formula looks like this: = LEFT ( B4 , FIND ( " " , B4 ) - 1 ) How this formula works FIND returns the...
To count the total words in a cell, you can use a formula based on the LEN and SUBSTITUTE functions. In the example shown, C3 contains this formula: = LEN ( TRIM ( B3 )) - LEN ( SUBSTITUTE ( B3 , " " , "" )) + 1 How the formula...
To remove some of the natural complexity of text (strip punctuation, normalize case, remove extra spaces) you can use a formula based on the SUBSTITUTE function, with help from the TRIM and LOWER functions. Context There may be times when you need...
The Excel SUBSTITUTE function replaces text in a given string by matching. For example =SUBSTITUTE("952-455-7865","-","") returns "9524557865"; the dash is stripped. SUBSTITUTE is case-sensitive and does not support wildcards.
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.