# trim first two and last two characters

#### egris52788

##### Board Regular
is there a formula that will trim the last two and first two characters of a 7 digit code in one sweep:

BEASW60 trimmed to ASW in the next cell.

### Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
If there are always 7 characters try

=MID(A1,3,3)

Here's one way:

=MID(A1,3,3)

HTH,

Smitty

Try this: =MID(A2,3,3) where A2 is your 7-digit code.

=MID(A1,3,3)

If it's always a 7-digit code you want "trimmed", then try

=MID(A1,3,3) where A1 houses the code.

5 identical solutions...is that a record?

just for a bit of variety......if you want to exclude the first 2 and last 2 characters whatever the string length

=IF(LEN(A1)>3,MID(A1,3,LEN(A1)-4),"")

and another way to do that:

=MID(A1,3,MAX(LEN(A1)-4,0))

Replies
2
Views
309
Replies
2
Views
214
Replies
3
Views
358
Replies
7
Views
341
Replies
2
Views
87

1,217,755
Messages
6,138,421
Members
450,136
Latest member
Tabako1960

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back