+ Reply to Thread
Results 1 to 9 of 9

=LEFT function

  1. #1
    Registered User
    Join Date
    03-12-2020
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Exclamation =LEFT function

    Hi all,

    First post so please go easy on me...

    I'm looking at using the =LEFT() fucntion to take the first 1 or 2 LETTERS (not numbers) of the a postcode, for example if a postcode is SW8 2AA, the formula would produce 'SW' or if the post code is S8 2AA the formula would produce 'S'.

    The alternative is to use the =LEFT(CELL,1 or 2), but this requires manual intervention when a psotcode has 1 or 2 letters.

    I've tried searching for this solution on Google but it doesn't bring back anything useful.

    Thanks,
    PC

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: =LEFT function

    Something like this seems to work:

    A
    B
    1
    SW8 2AA SW
    2
    S8 2AA S



    A
    B
    1
    SW8 2AA =TRIM(LEFT(TEXTJOIN("",1,IF(ISNUMBER(MID(A1,SEQUENCE(LEN(A1)),1)*1),REPT(" ",100),MID(A1,SEQUENCE(LEN(A1)),1))),20))
    2
    S8 2AA =TRIM(LEFT(TEXTJOIN("",1,IF(ISNUMBER(MID(A2,SEQUENCE(LEN(A2)),1)*1),REPT(" ",100),MID(A2,SEQUENCE(LEN(A2)),1))),20))


    EDIT: when I see jeffrey's formula below, I see that I've overdosed.
    Last edited by KOKOSEK; 03-12-2020 at 09:55 AM.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: =LEFT function

    How about in B2 copied down assuming your data starts in A2

    =IF(LEN(LEFT(A2,FIND(" ",A2)-1))=3,LEFT(A2,2),LEFT(A2))

    Edit: Maybe that won't work for you as you did say not numbers
    HTH
    Regards, Jeff

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: =LEFT function

    Or try this

    Enter formula in Cell B1 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 SW8 2AA SW
    2 S8 2AA S
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    06-24-2018
    Location
    India
    MS-Off Ver
    2016
    Posts
    45

    Re: =LEFT function

    Place you value in cell A1 and use below formula: (See attachment for details)

    =IF(AND(--ISNUMBER(VALUE(MID(A1,1,1)))=0,--ISNUMBER(VALUE(MID(A1,2,1)))=0),LEFT(A1,2),IF(AND(--ISNUMBER(VALUE(MID(A1,1,1)))=0,--ISNUMBER(VALUE(MID(A1,2,1)))=1),LEFT(A1,1),""))

    Hope it helped you?
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,112

    Re: =LEFT function

    Another option
    =LEFT(A2,IF(ISNUMBER(MID(A2,2,1)+0),1,2))

  7. #7
    Registered User
    Join Date
    03-12-2020
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Re: =LEFT function

    Thank you all for your help, this is brilliant.

  8. #8
    Registered User
    Join Date
    03-12-2020
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Re: =LEFT function

    This has done the job perfectly, exactly what I wanted.

    Thanks for your help.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,112

    Re: =LEFT function

    You're welcome & thanks for the feedback

+ 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. [SOLVED] How to nest a left function within a sumif function?
    By LisaK in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-09-2017, 09:21 AM
  2. [SOLVED] Embed left function in match/index function
    By Kyle18 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-12-2016, 05:17 AM
  3. [SOLVED] IF Function referencing IsNumber, Match, Left function on separate sheets
    By Touch9713 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-12-2013, 10:09 PM
  4. Replies: 2
    Last Post: 03-26-2012, 10:05 AM
  5. [SOLVED] HOW DO I NEST THE VLOOKUP FUNCTION WITH THE LEFT FUNCTION
    By CHAIM in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  6. HOW DO I NEST THE VLOOKUP FUNCTION WITH THE LEFT FUNCTION
    By CHAIM in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  7. [SOLVED] HOW DO I NEST THE VLOOKUP FUNCTION WITH THE LEFT FUNCTION
    By CHAIM in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-27-2005, 04:10 PM

Tags for this Thread

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