Site icon Mister Dif Reviews

Get the Last Word in Google Sheets Cell or Excel Cell

the-last-word-in-google-sheets

Background photo by https://unsplash.com/@simson_petrol

Here’s what you need to retrieve the last word (or the first) in Google Sheets cells or using Excel if that’s your preference.

Get the Last Word in Google Sheets

=TRIM( RIGHT( SUBSTITUTE( A1 ; " " ; REPT( " " ; 100 ) ) ; 100 ) )

but if you might have any trailing spaces in your cell use this to get the last word.

=TRIM( RIGHT( SUBSTITUTE( TRIM( A1 ) ; " " ; REPT( " " ; 100 ) ) ; 100 ) )

To use it, put the the phrase you want to parse for the last work in cell A1 and the function above in cell B1 and hit enter.  Or put a whole column of phrases into the A column, setup the function in the B column and drag it down from the bottom right corner.





Drag down and you have your last word  from the phrase parsed into column B.

Parse last word in Excel cell

This works to parse the last word in excel

=MID(SUBSTITUTE(A1," ","^",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))),FIND("^",SUBSTITUTE(A1," ","^",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+1,256)

Example:



Get the First Word in Google Sheets

By the way, if you want the first word in a cell? Change “RIGHT” to “LEFT” in the formula. So…

=TRIM( LEFT( SUBSTITUTE( A1 ; " " ; REPT( " " ; 100 ) ) ; 100 ) )

Source:https://howtouseexcel.net/how-to-extract-the-last-word-in-a-cell-in-excel

Change the last word to titlecase in Google Sheets

This can be done by wrapping the function in Proper. Here’s the function for the last word in Google Sheets changed to titlecase:

=PROPER(TRIM( RIGHT( SUBSTITUTE( A2 , " " , REPT( " " , 100 ) ) , 100 ) ))

and here's the function for the first word changed to title titlecase:

=Proper(TRIM( LEFT( SUBSTITUTE( A1 ; " " ; REPT( " " ; 100 ) ) ; 100 ) ))

Exit mobile version