Extracting PARTIAL words from cell

Rk_Digital

New Member
Joined
Nov 15, 2019
Messages
3
I'm in a worksheet and trying to extract the words after the 3rd and 4th hyphens when they're available in column A (see table below for representation).


Digital - workbook - sheet
Digital - workbook - app
Digital - workbook - test
Digital - workbook - sheet - max - version1
Digital - workbook - sheet - max - version2
Digital - workbook - sheet - max - version1
Digital - workbook - sheet - max - version2

<tbody>
</tbody>

The first 3 rows only have 3 words with 2 hyphens - for these rows, I wouldn't want anything to extract into column B. I would want those cells to stay blank, but when the 4th row comes up, there are 5 words with 4 hyphens and I need the words (with the hyphen) that are listed after the 3rd hyphen to show up in column B.

I'm looking for a formula or VBA function/sub that I can continuously run down column B that will be able to extract the portion after the 3rd hyphen.

For example, if the formula ran correctly, the first 3 rows in column B would be blank and then next 4 would be as follows...
max - version1
max - version2
max - version1
max - version2

<colgroup><col></colgroup><tbody>
</tbody>

Any help would be GREATLY appreciated!

Thank you very much!!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Welcome to the Board!

Let's pick a character that we would never have in our data, like maybe a tilde (~). Then as long as the values between your hyphens aren't longer than 255 characters, I think something like this should work (for an entry in cell A1):
Code:
=SUBSTITUTE(TRIM(MID(SUBSTITUTE(A1,"-","~" & REPT(" ",255)),750,1000)),"~","-")
 
Last edited:
Upvote 0
It worked for me.

Did you remember to change the cell references to match the cell your data resides in?

Did you try it on an example like you posted in your original post, or did you try it on other data?
If on other data, can you post an example of the data you actually did try it on, so I can try it on that to?
Otherwise, you and me are comparing "apples and oranges".
 
Last edited:
Upvote 0
I did forget to change something, but it's working great now! Thank you so much!
I really appreciate your help and how quick you were!
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,051
Members
448,940
Latest member
mdusw

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