Extract text 8 characters after second ^

Kazoo6613

New Member
Joined
Mar 1, 2014
Messages
7
I've only recently found this forum and have found it wonderfully helpful.

I'm trying to extract text from the following string:

%B6100569849384652^GRAHAM/DAVID EXAMPLE ^180579911965022VNDAVID

The first thing I would like to do is extract the 8 digits (birthday) after the 8 digits after the 2nd ^ (the digits I have highlighted in green).

The second thing I would like to do is extract the 2 letters after the green numbers (highlighted in blue)

So far with the help of this forum I have figured how to extract the name and the 10 digits to the left of the first ^,but now I'm stumped. Thanks to all.

Excel version 2010.
 
Last edited:
I think I might have worked it out with this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("a1:a10000")) Is Nothing Then
Application.EnableEvents = False
Range("B" & Target.Row).Value = Now
Application.EnableEvents = True
End If
End Sub

I am able to protect the rest of the spreadsheet - columns C,D,E,F- with A & B unprotected.
Thanks again to all for your help above.
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
If the second ^ is always preceded by a space, but the first never (as in the example):

to extract the number:

=MID(A1,FIND(" ^",A1,20)+10,8)

the 2 letters:

=MID(A1,FIND(" ^",A1,20)+18,2)
 
Upvote 0
Kazoo6613,

In the line where you are setting the format you have omitted the offset values so effectively it is formatting column A.

Try the following which will alow you to have column B locked.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Range("a2:a10000")
If Not Intersect(Target, rng) Is Nothing Then
ActiveSheet.Unprotect
Target.Offset(, 1) = Now
Target.Offset(, 1).NumberFormat = "dd/mmm/yyyy"
ActiveSheet.Protect
End If
End Sub

Hope that helps.
 
Last edited:
Upvote 0
Try
=MID(A1, FIND("^", A1&"^^", FIND("^",A1&"^^")+1)+9, 8)
and
=MID(A1, FIND("^", A1&"^^", FIND("^",A1&"^^")+1)+17, 2)
For what it's worth, aren't the red characters superfluous?
 
Upvote 0
Sorry, my #12 correctly:

to extract the number:

=MID(A1,FIND(" ^",A1)+10,8)

the 2 letters:

=MID(A1,FIND(" ^",A1)+18,2)
 
Upvote 0
Thank you all. Peter, your VBA code worked perfectly.
First off, Peter did not post any "code", Tony (Snakehips) did... is his the code you were referring to?

Second, did you ask two separate, independent questions in this thread (Tony's code seems to have nothing to do with the original question you asked)? If yes, please ask new questions in a new thread instead of jumping on the back of an existing thread (even if that existing thread is yours)... it will help people in the future who search for information in old threads if multiple solutions are not all jumbled up with each other in the way this thread appears to be... separate threads for separate questions assures that will not happen.
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,931
Members
449,134
Latest member
NickWBA

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