Results 1 to 4 of 4

Challenge to find exact text string match

Threaded View

  1. #1
    Registered User
    Join Date
    01-21-2014
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    74

    Challenge to find exact text string match

    In the four rows of text below I'm trying to match each gas stick to its corresponding gasline.

    I think I can count over to "GAS STICK" and get the number. <15>
    From that point I can count over to "," (comma) and get that number. <26>
    So the gas stick will be between the first number and one less than the second number. <GAS STICK 1>

    I need help completing this code to place a the line or stick number in a cell B of the same row.
    Column A would have the description and column B of the same row would either be "1" or "11" respectively.
    Column C would be the shortened description (GAS STICK 1).


    1] "HUNGA, DUNGA, GAS STICK 1, THINGY"
    2] "DOHICKY, GAS STICK 11, THINGUS"
    3] "SCAPPEN, DAPPER, GASLINE 1"
    4] "SUCH, AND, SUCH, GASLINE 11"


    Sub test()
    
    Dim MainWS As Worksheet
    Dim FirstNum As Integer
    Dim LastNum As Integer
    Dim ParentSTR As String
    Dim ActiveRow As Long
    Dim ActiveCol As Long
    Dim LastRow As Long
    
    LastRow = MainWS.Cells(Rows.Count, 1).End(xlUp).Row
    ActiveCol = 1 'Column A
    
    For ActiveRow = 2 To LastRow
    
      ParentSTR = Cells(ActiveRow, ActiveCol).Value
    
      FirstNum = InStr(1, ParentSTR, "GAS STICK")
      LastNum = InStr(FirstNum, ParentSTR, ",")
      LastNum = LastNum -1
    
    Next ActivRow
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Instr to look for a complete, exact match of a string
    By SandPounder1 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-30-2014, 03:50 PM
  2. [SOLVED] Possible to search for a substring withing a string of text which is an exact match?
    By Urugmo88 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-07-2014, 04:09 AM
  3. Find an exact word within a text string
    By juanmimr in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-08-2013, 10:30 AM
  4. [SOLVED] Find Exact Match Text String Using Formula
    By sweetrevelation in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-12-2012, 10:53 AM
  5. [SOLVED] Count if - not exact match - from cell not string
    By s_twigge in forum Excel General
    Replies: 2
    Last Post: 06-27-2012, 10:44 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1