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:
[TABLE="width: 236"]
<tbody>[TR]
[TD]c2=\Data Tab\Get & Transform[/TD]
[/TR]
[TR]
[TD]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[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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,223,894
Messages
6,175,254
Members
452,624
Latest member
gregg777

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