Extracting a segments from each cell

Excel_77

Active Member
Joined
Sep 15, 2016
Messages
311
Office Version
  1. 2019
Platform
  1. Windows
Hi All,

In column D I have a person's name along with their unique ID so for example the format would be in "Bloggs, Joe (12345678)", what I want is in column E to include the unique ID for each person without the brackets (), is there a quick and easy way to do this?

Thanks
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
If ALL the IDs are 8 digits long and there's no other data on the right of the ID (apart form the right bracket) then this should work

=SUBSTITUTE(RIGHT(A1,9),")","")

Otherwise this will find the first left bracket and extract up till the next right bracket regardless of the length of the ID.

=MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1)
 
Last edited:
Upvote 0
If ALL the IDs are 8 digits long and there's no other data on the right of the ID (apart form the right bracket) then this should work

=SUBSTITUTE(RIGHT(A1,9),")","")

Otherwise this will find the first left bracket and extract up till the next right bracket regardless of the length of the ID.

=MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1)

Superb, thanks so much. I have opted for the below code that you provided, however could you explain what it means? I would struggle to build this code on my own.

=MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1)

Thanks again.
 
Upvote 0
It finds the first left bracket in A1 - FIND("(",A1)
It finds the first right bracket in A1 - FIND(")",A1)
and extracts the data between the brackets - MID(A1,left bracket position+1,right bracket position-1)
 
Upvote 0
It finds the first left bracket in A1 - FIND("(",A1)
It finds the first right bracket in A1 - FIND(")",A1)
and extracts the data between the brackets - MID(A1,left bracket position+1,right bracket position-1)

I think I almost get it but I want to double check this with you:

=MID(A1, This returns the middle value between the brackets

FIND("(",A1)+1, - Find the first left bracket "(" and that use the first character after this (+1)

FIND(")",A1)- Not sure what this does in the middle

FIND("(",A1)-1) Find the first right bracket ")" and that use the first character before this (-1)
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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