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).


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Digital - workbook - sheet[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Digital - workbook - app[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Digital - workbook - test[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Digital - workbook - sheet - max - version1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Digital - workbook - sheet - max - version2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Digital - workbook - sheet - max - version1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Digital - workbook - sheet - max - version2[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

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...
[TABLE="width: 472"]
<colgroup><col></colgroup><tbody>[TR]
[TD]max - version1[/TD]
[/TR]
[TR]
[TD]max - version2[/TD]
[/TR]
[TR]
[TD]max - version1[/TD]
[/TR]
[TR]
[TD]max - version2[/TD]
[/TR]
</tbody>[/TABLE]

Any help would be GREATLY appreciated!

Thank you very much!!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
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,224,818
Messages
6,181,152
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