Selecting certain characters within a cell

TXkleen

New Member
Joined
Oct 19, 2017
Messages
9
I have data in cells that vary between 13 and 14 characters.

AA1234567BBBB
or
AAA1234567BBBB

I need to be able to extract the 1234567 data from each cell, but am not sure how. Can I somehow use the LEFT function to grab the 7 characters the proceed the last 4?

Thanks!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Welcome to the board.

Try:
Code:
=SUBSTITUTE(SUBSTITUTE(A1,"A",""),"B","")
 
Upvote 0
In my examples, the "AA" and "AAA" were just placeholders. The first 2 or 3 characters or each cell are a brand code, and they can vary wildly. Thus, I don't think that your code will work?
 
Upvote 0
Can I somehow use the LEFT function to grab the 7 characters the proceed the last 4?

Hi, you could try this option which adopts the logic quoted above.


Excel 2013/2016
AB
11234567WXY1234567
21234567WXYZ1234567
3A1234567WXYZ1234567
4AB1234567WXYZ1234567
5ABC1234567WXYZ1234567
6ABCD1234567WXYZ1234567
7ABCDE1234567WXYZ1234567
8ABCDEF1234567WXYZ1234567
Sheet1
Cell Formulas
RangeFormula
B1=MID(A1,MAX(1,LEN(A1)-10),7)
 
Upvote 0
For further clarification, the brand code can be 2 or 3 digits, and vary wildly. The 7 character product code (shown as 1234567 above) is a combo of numbers and letters, and the final four characters are a unit of measure code which can vary and contain numbers and letters.

Brand Code + Product Code + UOM

As the UOM and Product Code's length are both fixed, I think it would be best to somehow select the 7 characters that precede the last 4 characters. Is that doable?
 
Upvote 0
Hi, you could try this option which adopts the logic quoted above.

Excel 2013/2016
AB
11234567WXY1234567
21234567WXYZ1234567
3A1234567WXYZ1234567
4AB1234567WXYZ1234567
5ABC1234567WXYZ1234567
6ABCD1234567WXYZ1234567
7ABCDE1234567WXYZ1234567
8ABCDEF1234567WXYZ1234567

<colgroup><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
B1=MID(A1,MAX(1,LEN(A1)-10),7)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>


We were typing at the same time. You nailed it!! Thank you so much!!
 
Upvote 0

Forum statistics

Threads
1,215,790
Messages
6,126,926
Members
449,349
Latest member
Omer Lutfu Neziroglu

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
Back
Top