Trim and Parentheses

Coachmannyz8

New Member
Joined
Feb 28, 2018
Messages
9
Good day,

I'm trying to use a formula to change the name and bring in the correct format into the appropriate cell, but I can't seem to find the right combination?

Example:
Data in cell B1 = Doe, John (John D. Doe)

my formula gives me = John Doe (John D. Doe) "=MID(G25&" "&G25,FIND(" ",G25)+0,LEN(G25))" or
Doe, John (John D. Doe) =TRIM(IF(ISERROR(OR(FIND("(",C3),FIND(")",C3))),C3,LEFT(C3,FIND("(",C3)-1)&MID(C3&" "&C3,FIND(" ",C3)+0,LEN(C3)))) or
Doe, John =SUBSTITUTE(C4,LEFT(MID(C4,FIND("(",C4),255),FIND(")",MID(C4,FIND("(",C4)+1,

My goal is to capture only = John Doe

Thanks in advance
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try
Code:
=MID(A1,SEARCH(",",A1)+2,SEARCH("(",MID(A1,SEARCH(",",A1)+2,999))-1)&LEFT(A1,SEARCH(",",A1)-1)
 
Upvote 0
Thanks for the assistance Scott, I truly appreciate it.

One additional note:

How would you modify this formula to capture all, and any other possible combinations of text for example:
Security Inspector (No commas), and sometimes the same words but in ALL CAPS
Closeout
blank cells

I tried different versions of TRIM formulas, but I seem to be missing a letter, or no spacing between the words, or a blank cell, and a #VALUE !
=TRIM(IF(ISERROR(OR(FIND("(",C3),FIND(")",C3))),C3,LEFT(C3,FIND("(",C3)-1)&MID(C3&" "&C3,FIND(" ",C3)+0,LEN(C3))))

Thank You Scott.
 
Upvote 0
FIND is case sensitive. Search is not. If case does not matter use search.


Is something like this what you want?
Code:
=IF(AND(ISNUMBER(SEARCH("security inspector",A1)),ISNUMBER(SEARCH("closeout",A1))),"Security inspector, closeout",IF(ISNUMBER(SEARCH("security inspector",A1)),"Security inspector",IF(ISNUMBER(SEARCH("closeout",A1)),"closeout","")))
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,280
Members
452,902
Latest member
Knuddeluff

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