Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to move last word to next adjacent cell?

Supposing, I have a list of text strings which I want to move the last word to next adjacent cell as following screenshot shown, of course, you can cut and paste them one by one, but, are there any quick ways for us to move them to next cell at once in Excel?

doc move last word to next cell 1

Move last word to next adjacent cell with VBA code

Extract last word to next adjacent cell with formula


arrow blue right bubble Move last word to next adjacent cell with VBA code


To cut and move the last word from one cell to the next adjacent cell, please apply the following VBA code:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Move last word to next adjacent cell:

Sub splitlastword()
    Dim xCell As Range
    Dim xStr As String
    Dim xAddress As String
    Dim xRg As Range
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Please selec the text cells:", "Kutools for Excel", xAddress, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    If xRg.Columns.Count > 1 Then
       MsgBox "Only one column in the seleted range", vbInformation, "Kutools for Excel"
       Exit Sub
    End If
    For Each xCell In xRg
        xStr = Trim(xCell.Value)
        xCell.Offset(0, 1) = Mid(xStr, InStrRev(xStr, " "))
        xCell.Value = Left(xStr, InStrRev(xStr, " "))
    Next
End Sub

3. Then press F5 key to run this code, and a prompt box is popped out to remind you selecting the text cells that you want to move the last word from, see screenshot:

doc move last word to next cell 2

4. And then click OK button, the last words in selected cells have been moved to the next adjacent right cells immediately, see screenshot:

doc move last word to next cell 1


arrow blue right bubble Extract last word to next adjacent cell with formula

If you just need to extract the last words from the text strings without moving them, the following formula can do you a favor.

Please enter this formula:

=RIGHT(A2,LEN(A2)-FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))) into a blank cell next to the text cell, and then drag the fill handle down to the cells which you want to extract the last word, all last words have been extracted from the text strings without moving the original ones. See screenshot:

doc move last word to next cell 3



Recommended Productivity Tools for Excel

Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

  • More than 300 powerful advanced features, designed for 1500 work scenarios, increasing productivity by 70%, give you more time to take care of family and enjoy life.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds, 
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

  • Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: 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!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.