Remove before first blank and after " ("

everblazing

Board Regular
Joined
Sep 18, 2015
Messages
156
HI

Im trying to have the below two formulas combined so that i can remove the first part of text before space and last of a text in same cell after " (".

appreciate any help.


text in cell A2 [TABLE="width: 468"]
<tbody>[TR]
[TD="class: xl64, width: 468"]200593 Senior Products Systems (United)[/TD]
[/TR]
</tbody>[/TABLE]

the formula in B2 this cuts out anything before space.
=MID(A2,FIND(" ",A2)+1,256)

this cuts out anything with " (" and after
=LEFT(B15197,FIND(" (",B15197)-1)

I need them combined.

thanks
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
hi

im trying to have the below two formulas combined so that i can remove the first part of text before space and last of a text in same cell after " (".

Appreciate any help.


Text in cell a2 [table="width: 468"]
<tbody>[tr]
[td="class: Xl64, width: 468"]200593 senior products systems (united)[/td]
[/tr]
</tbody>[/table]

the formula in b2 this cuts out anything before space.
=mid(a2,find(" ",a2)+1,256)

this cuts out anything with " (" and after
=left(b15197,find(" (",b15197)-1)

i need them combined.

Thanks
??
Code:
=left(mid(a2,find(" ",a2)+1,256),find(" (",mid(a2,find(" ",a2)+1,256))-1)
 
Upvote 0
wow that works, how did you manage that? i'd love a basic explanation. what was the first step you took to put the two together?

so if i was tp put that in a macro that autofills from the first blank cell in a column to the last empty cell in a collumn is it best to use .address range?

Regards.
 
Last edited:
Upvote 0
wow that works, how did you manage that? i'd love a basic explanation. what was the first step you took to put the two together?

so if i was tp put that in a macro that autofills from the first blank cell in a column to the last empty cell in a collumn is it best to use .address range?

Regards.
given from your post

the formula in B2 this cuts out anything before space.
=MID(A2,FIND(" ",A2)+1,256)

(modified this) this cuts out anything with " (" and after
=LEFT(A2,FIND(" (",A2)-1)

used your
MID(A2,FIND(" ",A2)+1,256) without the equal sign of course,
and inserted that to
=LEFT(MID(A2,FIND(" ",A2)+1,256),FIND(" (",MID(A2,FIND(" ",A2)+1,256))-1)

make sense now?

for the macro part, i can make out without a formula, omitting those characters.
 
Last edited:
Upvote 0
Though above answeres already solved your problem, I'd like to provide more options, please try the following:

=VLOOKUP(" *",MID(A2,ROW($2:99)-{1,0},FIND("(",A2)-FIND(" ",A2)-2),2,)
(Ctrl+Shift+Enter)

=REPLACE(LEFT(A2,FIND("(",A2)-2),1,FIND(" ",A2),"")

=TRIM(MID(SUBSTITUTE(A2,"(",REPT(" ",99)),FIND(" ",A2),99))

=TRIM(MID(A2,FIND(" ",A2),SUM(FIND({" ","("},A2)*{-1,1})))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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