Extract text from a cell?

MOB

Well-known Member
Joined
Oct 18, 2005
Messages
1,066
Office Version
  1. 365
Platform
  1. Windows
Cells will contain a number beginning with 2 - can be anywhere in the cell, and number ends when a space appears after it.

Can I use a formula just to return the number?

eg;

ABC 2014999 DDD
2014999 EE FGH
A 2014999 A R E

In each case the result should be 2014999. Needs to be a formula rather than find/replace and any VB methods.

TIA
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
If it always starts with 2 this works:

=0+MID(A1,FIND("2",A1),FIND(" ",MID(A1&" ",FIND("2",A1),LEN(A1)))-1)
 
Last edited:
Upvote 0
It does always start with 2 so that's great thanks
 
Upvote 0
Heres slight adaptation that means it doesnt fail should the number just be there without any other lettering:

=0+MID(A1,FIND("2",A1),FIND(" ",MID(A1&" ",FIND("2",A1),LEN(A1)+1))-1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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