formula help for a nood please

owenstrev

New Member
Joined
Feb 6, 2020
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Can someone please help me extract the first 4 numbers out of a cell, and then separate them as into 2 different columns. The example below is what I am trying to accomplish. I have the first column(O2) and I need it to produce the 2 columns on the right.

Book1
OPQ
1ABCDFIRST YEARLAST YEAR
2 7521 BN
3 1416 BN1416
4W1013 BN1013
5W0407 BN0407
6W0514 BN0514
7M9908 BN9908
8M9908 BN9908
9W0717 BN0717
10W1316 BN1316
11M0005 BN0005
12 0616 BN0616
13 0620 BN0620
14 0307 BN0307
15 9920 RN9920
16 0311 RN0311
17W9704 RN9704
18W0513 BN0513
19 0721 BN0721
20 66187BN6618
21W0305 BN
22W0310 RN
23W0310 RN
TYPE RETURN HERE


thank you in advance
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
If, when there is a letter at the start, it is always a single letter then the following two formulas should work:

In column P - =IF(ISNUMBER(VALUE(LEFT(M3,1))),LEFT(M3,2),MID(M3,2,2))
In Column Q - =IF(ISNUMBER(VALUE(LEFT(M3,1))),MID(M3,3,2),MID(M3,4,3))
 
Upvote 0
If, when there is a letter at the start, it is always a single letter then the following two formulas should work:

In column P - =IF(ISNUMBER(VALUE(LEFT(M3,1))),LEFT(M3,2),MID(M3,2,2))
In Column Q - =IF(ISNUMBER(VALUE(LEFT(M3,1))),MID(M3,3,2),MID(M3,4,3))

Thank you so much, this almost works, the only issue coming up is when there is a total of 5 numbers, in this case the second formula pulls in the last 3 digits, ex: on row 20 it is returning the value "187" instead of just "18"
 
Upvote 0
Thank you so much, this almost works, the only issue coming up is when there is a total of 5 numbers, in this case the second formula pulls in the last 3 digits, ex: on row 20 it is returning the value "187" instead of just "18"

Putting this here incase anyone is following the thread,
Column Q - =IF(ISNUMBER(VALUE(LEFT(M3,1))),MID(M3,3,2),MID(M3,4,3))
changed to
Column Q - =IF(ISNUMBER(VALUE(LEFT(M3,1))),MID(M3,3,2),MID(M3,4,2))

fixed it, thank you StuLux for being so smart and helping me out.
 
Upvote 0
Ah yes, I missed the 'rogue' entry that had 5 digits and, in my testing, I didn't have a space in front of this one so the formula worked, you're quite right to change the 3 to 2, glad to have been of help.
 
Upvote 0

Forum statistics

Threads
1,214,863
Messages
6,121,978
Members
449,058
Latest member
oculus

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