+ Reply to Thread
Results 1 to 6 of 6

Extracting last characters from a cell.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    Extracting last characters from a cell.

    I have about 1000 addresses in this format:

    Dysart Road
    Grantham
    Lincolnshire
    NG31 7AA

    They are all in one single cell, with Alt Enter separating each line of the address. Does anyone have any advice on how I can pull out the post code, which comes after after the final "Alt Enter" in every cell.

    The number of rows in the cell is different, and the last six letters doesn't work because obviously the number of characters in the postcode varies.

    Will love anyone who can solve this!

    Thanks!

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Extracting last characters from a cell.

    hi davidx, welcome to the forum. maybe:
    =MID(A1,FIND("^",SUBSTITUTE(A1,CHAR(10),"^",LEN(A1)-LEN(SUBSTITUTE(A1,CHAR(10),"")))),LEN(A1))

    if it doesn't work, upload a sample Excel file. show some examples of your desired answers

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Extracting last characters from a cell.

    Alternate formula:
    =TRIM(RIGHT(SUBSTITUTE(A1,CHAR(10),REPT(" ",99)),99))
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: Extracting last characters from a cell.

    try this (array formula)
    {REPLACE(A1,1,MAX(IF(MID(A1,ROW(1:100),1)=" ",ROW(1:100))),"")}

  5. #5
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: Extracting last characters from a cell.

    Thanks guys, none of those methods worked however in the end i found this as a solution:

    http://www.accountingweb.com/topic/t...-columns-excel

    Not as beautiful as your efforts though

  6. #6
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: Extracting last characters from a cell.

    if that you mean, so try this option (array formula)
    {=REPLACE(A1,1,MAX(IF(MID(A1,ROW(1:100),1)=CHAR(10),ROW(1:100))),"")}

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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