LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Extract text from text string

On Wednesday, February 10, 2021 at 7:42:51 AM UTC-5, Claus Busch wrote:
Hi John,
Am Wed, 10 Feb 2021 03:48:04 -0800 (PST) schrieb john taiariol:

the coordinates are not always 7 characters.

try:
=IFERROR(IF(LEFT(A1,1)="X",TRIM(SUBSTITUTE(A1,"X", )),TRIM(MID(LEFT(SUBSTITUTE(A1,"F","Z"),FIND("Z",S UBSTITUTE(A1,"F","Z"))-1),FIND("X",LEFT(SUBSTITUTE(A1,"F","Z"),FIND("Z",S UBSTITUTE(A1,"F","Z"))-1))+1,99))),"")

If that doesn't work use an UDF.
Copy following code into a module and call the function in the sheet
with =Coord(A1)

Function Coord(myRange As Range) As String
Set re = CreateObject("vbscript.regexp")
mystring = Replace(myRange.Text, " ", "")
ptrn = "X\d{1,3}\.\d{1,3}"
re.Pattern = ptrn
re.Global = True
re.ignoreCase = False
Set matches = re.Execute(mystring)
If matches.Count 0 Then
Coord = Mid(matches(0), 2)
End If
End Function
Regards
Claus B.
--
Windows10
Microsoft 365 for business


I was able to get it working thank you all for your help
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract value from a text string Dinesh Excel Worksheet Functions 11 April 30th 09 04:29 AM
Need to extract certain text from text string Trista @ Pacific Excel Worksheet Functions 4 November 21st 07 07:07 PM
Extract text from a string ellebelle Excel Worksheet Functions 4 June 13th 07 04:25 PM
Extract text string using MID Turk Excel Worksheet Functions 5 October 11th 06 06:39 PM
EXTRACT TEXT FROM TEXT STRING carricka Excel Worksheet Functions 4 July 8th 05 11:00 AM


All times are GMT +1. The time now is 04:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"