# IF & LEN together

1. ## 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. ## 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

3. ## Re: IF & LEN together

Or you could try

=INT(B1/10)

#### Thread Information

##### Users Browsing this Thread

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

#### 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