This video will look at one approach to extract the last word in a string in a selected range in Excel.
In this example, we want to delete a person’s title or bracketed other name from their first name. Sure we can delete each cell separately. However, if we have a large data set, then it is preferable to write a customized macro.
In summary, we want a macro that will extract only the last word in a string across the selected cell range. This is a follow-up to an earlier video, “How to extract the first word in a string with Excel VBA“.
Certainly we can delete each cell separately, but if we have a large data range, then it is best to write a customised macro.
How to write the macro
Go into Visual Basic Editor, and insert a module.
Don’t forget to notate your macro. As it will help future users to better understand your macro where necessary. We will call this macro lastRightWord.
Feel free to download the following Excel workbook. It contains the macro to extract the last word in a string across a selected range of cells.
Download SpreadsheetVault – Remove words before last right word (solution).xlsb