Need help with a formula please.

MikeyZ

Well-known Member
Joined
Mar 14, 2002
Messages
553
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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You can use this:
=IFERROR(MID(H1,SEARCH(630,H1),6),"")

Sincerely,
Max
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,485
Members
448,967
Latest member
visheshkotha

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