Combine Substitute & Right

Bravo2003

Active Member
Joined
Apr 1, 2010
Messages
278
Office Version
  1. 365
Platform
  1. Windows
I'm going round in loops trying to combine my formula
Cell text contains various make up of a text string
"Market Cap: LargeInvestment Style: Growth" (please note, there is no space between "Large" & "Investment" in all cells and the space between Style: and next word is not consistent.)

Need to get the text to become Large-Growth
these 2 parts of the string vary in each cell - Large, Mid, Small, etc.. / Growth, Value, Blend, etc...

I have made 2 formula to get part way
=SUBSTITUTE(P2,"Investment Style: ","-")
gets me to
"Market Cap: Mid-Growth"

and separately I have
=RIGHT(P2,LEN(P2)-FIND(": ",P2))
This removes the "Market Cap: " section to give
" MidInvestment Style: Growth"

So i don't have to add columns to do this in stages, was trying to get the 2 formula in to 1 column to combine the process?
Am I on the right track or is there a better option?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I'm going round in loops trying to combine my formula
Cell text contains various make up of a text string
"Market Cap: LargeInvestment Style: Growth" (please note, there is no space between "Large" & "Investment" in all cells and the space between Style: and next word is not consistent.)

Need to get the text to become Large-Growth
these 2 parts of the string vary in each cell - Large, Mid, Small, etc.. / Growth, Value, Blend, etc...

I have made 2 formula to get part way
=SUBSTITUTE(P2,"Investment Style: ","-")
gets me to
"Market Cap: Mid-Growth"

and separately I have
=RIGHT(P2,LEN(P2)-FIND(": ",P2))
This removes the "Market Cap: " section to give
" MidInvestment Style: Growth"

So i don't have to add columns to do this in stages, was trying to get the 2 formula in to 1 column to combine the process?
Am I on the right track or is there a better option?
Try

Excel Formula:
=TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(P2,"Investment Style: ","-"),":",REPT(" ",99)),99))
 
Upvote 0
Try

Excel Formula:
=TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(P2,"Investment Style: ","-"),":",REPT(" ",99)),99))
Thanks, yes that works, just an issue where the space between the last word is not consistent, so it gives either
Mid-Growth
or
Mid- Growth

Any way to remove the unwanted space?
 
Upvote 0
Thanks, yes that works, just an issue where the space between the last word is not consistent, so it gives either
Mid-Growth
or
Mid- Growth

Any way to remove the unwanted space?
Can you post some more examples of your data using below link?
 
Upvote 0
Otherwise Try

Excel Formula:
=SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(C8,"Investment Style: ","-"),":",REPT(" ",99)),99))," ","")
 
Upvote 0
Solution
Can you post some more examples of your data using below link?

Data is as this:
Market Cap: Mid
Investment Style: Growth
Market Cap: Large

Investment Style: Growth
Market Cap: Large

Investment Style: Blend
Market Cap: Mid

Investment Style: Growth
Market Cap: Large

Investment Style: Growth
Market Cap: Large

Investment Style: Growth
Market Cap: Mid

Investment Style: Growth
Market Cap: Large

Investment Style: Growth
Market Cap: Large

Investment Style: Blend
Market Cap: Mid

Investment Style: Value
Market Cap: Mid

Investment Style: Blend
Market Cap: Large

Investment Style: Value
Market Cap: Large

Investment Style: Blend
Market Cap: Mid

Investment Style: Blend
Market Cap: Large

Investment Style: Blend
Market Cap: Large

Investment Style: Value
Market Cap: Small

Investment Style: Blend
Market Cap: Large

Investment Style: Blend
 
Upvote 0
Hi,

Just another way:

Book3.xlsx
AB
1Market Cap: LargeInvestment Style: GrowthLarge-Growth
Sheet924
Cell Formulas
RangeFormula
B1B1=SUBSTITUTE(SUBSTITUTE(MID(A1,FIND(":",A1)+1,99),"Investment Style: ","-")," ","")
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,143
Members
453,021
Latest member
Justyna P

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