# Need help with a formula please.

#### MikeyZ

##### Well-known Member
Here are a few of the lines of data.
Each is in one cell in column H on a line.

420BOZ(), 629PZA(), 629GED(), 629ZFA(), 630ZQA(), 630PFA()
430ZZA(), 521ZZA(), 629PZA(), 629GED(), 629ZZA(), 630PEA()
430ZZA(), 521ZZA(), 629PZA(), 629GED(), 629ZZA(), 630ZQA()
532ZZA(), 850JGA(), 850NAA(), 265DEB(), 860SRA(), 860RCA()

In an adjacent cell all I want to do is pull the first 6 digits of the first number that starts with 630.
If there isn't any I want a blank cell.
Can anyone come up with a working formula, I'm stuck.

### Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

#### Max1616

##### Well-known Member
You can use this:
=IFERROR(MID(H1,SEARCH(630,H1),6),"")

Sincerely,
Max

#### MikeyZ

##### Well-known Member
Thank you.. Works great..

#### pjmorris

##### Well-known Member
Hi Mikey,

An alternative solution would be to use this: =IF(LEFT(H1,3)="630",LEFT(H1,6),"")

Both will work with the data you've provided, but Max's solution will also return '630AA(' if the source data were something like: 8630AA() ie the 630 is within the string rather than at its start.

Just a thought.

Regards

Peter

Replies
12
Views
580
Replies
0
Views
462
Replies
0
Views
217
Replies
4
Views
187
Replies
0
Views
321

1,190,627
Messages
5,982,011
Members
439,751
Latest member
megaman777

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