Looking to Adapt This or New One to Parse Cell by Character

Alex20850

Board Regular
Joined
Mar 9, 2010
Messages
146
Office Version
  1. 365
Platform
  1. Windows
My data looks like this:
c2=\Data Tab\Get & Transform
c3=\View Tab\Show/Hide\Ruler

I am looking for a function - for this example named Parse where Parse(c2,"",1) equals Data Tab
Parse(c3,"",2) equals Show/Hide

<tbody>
</tbody>
Public Function separate(field As String, separator As String)
Dim fieldlength As Integer
fieldlength = Len(field)
separate = ""
Dim i As Integer
For i = 1 To fieldlength
separate = separate + Mid(field, i, 1)
separate = separate + separator
Next
separate = Mid(separate, 1, (fieldlength * 2) - 1)
End Function
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Does this function do what you want? The first argument is either a cell reference containing text or expression evaluating to a text string, the second argument is the text to be used as the delimiter separating the fields and the third argument is the field number to return.
Code:
[table="width: 500"]
[tr]
	[td]Function Field(Text As String, Delimiter As String, FieldNumber As Long) As String
  Field = Split(Text, Delimiter)(FieldNumber)
End Function[/td]
[/tr]
[/table]
Note: The FieldNumber argument starts at 0 which is the text before the first delimiter.
 
Upvote 0
Wonderful!! Very short, too the point, and powerful!! Thank you!
 
Upvote 0

Forum statistics

Threads
1,215,475
Messages
6,125,028
Members
449,205
Latest member
Eggy66

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