+ Reply to Thread
Results 1 to 11 of 11

How can i CUT last two words from each line to move to another cel?

  1. #1
    Registered User
    Join Date
    03-15-2024
    Location
    Romania
    MS-Off Ver
    Microsoft 365 Business Basic
    Posts
    1

    How can i CUT last two words from each line to move to another cel?

    How can I cut the last two words from a column and move them to the next column on the right? I would like to know if there is any order to be able to apply it to the whole file. More precisely, I have to move the postal code from the addresses to another column separately. I am attaching a picture below.
    Screenshot 2024-03-15 193309.png

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: How can i CUT last two words from each line to move to another cel?

    Try

    with address in A1

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: How can i CUT last two words from each line to move to another cel?

    John's formula will copy the Post Code to the next column. If you want to "move" it, you'd need VBA.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: How can i CUT last two words from each line to move to another cel?

    As TMS noted (and I "missed") you will need VBA if you need to delete the post code from the "FullAddress" entry. Please post a sample file: instructions on "how to" are in the yellow banner at top of the page.
    Last edited by JohnTopley; 03-16-2024 at 04:05 AM.

  5. #5
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How can i CUT last two words from each line to move to another cel?

    Could be done by Power Query too.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,918

    Re: How can i CUT last two words from each line to move to another cel?

    Nothing can be 'moved' with PowerQuery, either. You would end up with a new version of the table with the original still intact.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How can i CUT last two words from each line to move to another cel?

    Well, just press Refresh.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: How can i CUT last two words from each line to move to another cel?

    You can only get rid of the "second" table if you create a query table (copy of base table). Then delete the base table and refer to the query table.

    That is what DJunqueira did here
    Last edited by JEC.; 03-16-2024 at 12:49 PM.

  9. #9
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: How can i CUT last two words from each line to move to another cel?

    Here a variation

    PHP Code: 
    let
        Source 
    Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        
    pCode Table.AddColumn(Source"Postcode_"each Text.AfterDelimiter(Text.Trim([Fulladdress])," ",{1RelativePosition.FromEnd})),
        
    replace Table.ReplaceValue(pCode,each [Fulladdress],each Text.Replace([Fulladdress],[Postcode_],"") ,Replacer.ReplaceValue,{"Fulladdress"}),
        
    result Table.RemoveColumns(replace,{"Postcode"})
    in
        result 

  10. #10
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: How can i CUT last two words from each line to move to another cel?

    And if you want VBA..

    Please Login or Register  to view this content.
    Last edited by JEC.; 03-16-2024 at 01:18 PM.

  11. #11
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How can i CUT last two words from each line to move to another cel?

    JEC you are right.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extract a last line of a multi-line cell, to move it below
    By FlorianBB in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-17-2022, 10:17 AM
  2. Move row to new sheet and delete - Explain this code line by line
    By omoHF in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-11-2018, 12:38 PM
  3. adding line breaks in cell, keeping words on same line
    By beba420 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2017, 07:45 PM
  4. Replies: 1
    Last Post: 03-16-2017, 04:41 PM
  5. Replies: 1
    Last Post: 04-05-2013, 03:40 PM
  6. [SOLVED] How do I move a line marker on a line column combination chart?
    By dknj30 in forum Excel General
    Replies: 7
    Last Post: 05-08-2012, 09:21 AM
  7. [SOLVED] Move equations from line to line automatically
    By Kingsobes in forum Excel General
    Replies: 1
    Last Post: 08-04-2005, 03:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1