+ Reply to Thread
Results 1 to 3 of 3

IF & LEN together

  1. #1
    Registered User
    Join Date
    08-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    14

    IF & LEN together

    Hello,

    I have a cell with 7 digits, but it may go up to 8 digits at anytime. I need to automatically either extract the 6 digits on the left of the 7 digits or the 7 digits from the left of the 8 digits.

    example:

    B1. 7634471 (I need just the 763447) =left(B1,6) works alone fine for 6, but what if it reads 76344719? I now need the 7634471. I tried the If and Len statement but it always only grabs the left 6 digits.

    Thanks for your help.

  2. #2
    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,647

    Re: IF & LEN together

    How about this?

    =LEFT(B1,LEN(B1)-1)

    However, you will need this to return a number rather than text:

    =--LEFT(B1,LEN(B1)-1)

    Excel 2016 (Windows) 32 bit
    B
    C
    1
    7634471
    763447
    2
    76344719
    7634471
    Sheet: Sheet1
    Last edited by AliGW; 07-28-2019 at 08:25 AM.
    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.

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: IF & LEN together

    Or you could try

    =INT(B1/10)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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