trim first two and last two characters

egris52788

Board Regular
Joined
Mar 6, 2003
Messages
114
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.
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650

ADVERTISEMENT

=MID(A1,3,3)
 

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828
If it's always a 7-digit code you want "trimmed", then try

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

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
5 identical solutions...is that a record? :cool:

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),"")
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
and another way to do that:

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

Watch MrExcel Video

Forum statistics

Threads
1,123,042
Messages
5,599,469
Members
414,312
Latest member
mikefire911

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top