Even simpler

Option Explicit
Sub GetFinalDestinationSAS()
Dim c As Range
Dim start As String
Dim final As String

Application.ScreenUpdating = False

For Each c In Range("a6:a" & Cells(Rows.Count, 1).End(xlUp).Row)
start = Left(c, 3)
If Not InStr(4, c, start) Then final = Right(c, 3)
If InStr(8, c, final) Then final = Mid(c, 9, 3)
If InStr(12, c, final) Then final = Mid(c, 13, 3)
c.Offset(, 2) = final
Next c
Application.ScreenUpdating = True

End Sub

Don Guillett
SalesAid Software
dguille...@gmail.com

From: Excel_Lover 
Sent: Thursday, December 29, 2011 3:36 AM
To: excel-macros@googlegroups.com 
Subject: $$Excel-Macros$$ To Extract a text with Conditions

Hi Experts,

Can somebody help me to extract a text called 'Final Destination' from the 
string.

Attached is a sample sheet with query.  

Thanks & Regards,
Faisal.

-- 
FORUM RULES (934+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (934+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to