Extracting ID's from middle of record.HELP

DShack

Board Regular
Joined
Jan 15, 2014
Messages
64
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello Everyone,
I'm trying to create a formula that extracts the employee id number out from the below record. The id is in bold. I have tried using left, mid function but have been unsuccessfull in doing so. any help would be greatly apprepriated.

Moussaoui, Abdelmjid 00224827 Fri,Aug 22 8.500 8.50 8.50 $73.78

Thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
bschwartz,

Thanks for the feedback.

I prefer to code, but, my archives are full of formulae like you have produced - thank you (y)
 
Upvote 0
It may not work if the ID not starts with 0

If the ID is always a 8-digit number, try:
=MID(A1,MIN(IFERROR(FIND(" "&{0,1,2,3,4,5,6,7,8,9},A1),999))+1,8)
CTRL SHIFT ENTER

If the ID may has different number of digits, then try:
=MID(A1,MIN(IFERROR(FIND(" "&{0,1,2,3,4,5,6,7,8,9},A1),999))+1,MIN(IFERROR(FIND({0,1,2,3,4,5,6,7,8,9}&" ",A1),999))-MIN(IFERROR(FIND(" "&{0,1,2,3,4,5,6,7,8,9},A1),999))+1)
CTRL SHIFT ENTER


This works with all of the examples you posted:

Worksheet Formulas
CellFormula
B1=LEFT(REPLACE(A1,1,FIND(0,A1)-1,""),FIND(" ",REPLACE(A1,1,FIND("0",A1)-1,""))-1)

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

<tbody>
</tbody>
 
Upvote 0
If the ID always has 8 digits, 3 functions seems enough:

=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),8)
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,742
Members
448,989
Latest member
mariah3

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