+ Reply to Thread
Results 1 to 3 of 3

Finding two sub-strings within a string

  1. #1
    Registered User
    Join Date
    04-24-2012
    Location
    San Francisco, USA
    MS-Off Ver
    Excel 2007
    Posts
    60

    Finding two sub-strings within a string

    Hi Guys

    I have the following code:

    Please Login or Register  to view this content.
    For some reason the instr functions dont seem to be working correctly. Are they correctly coded?

    many thanks
    Last edited by JBeaucaire; 05-22-2015 at 08:46 AM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Finding two sub-strings within a string

    well from what I know they are "coded" correctly...but probably not doing what you want....

    InStr() returns a number. The where the first occurrance of the string you are looking for in the string you are searching. Next you are using a "&" which is a concatenation not an AND statement.

    So, if you are trying say something like If this string is in this string AND this string is in this string, then this might work better

    Please Login or Register  to view this content.
    basically this says if the first Instr() returns something greater than 0, it found the string AND if the second Instr() returns something greater than 0, it found something, continue into the IF statement...hopefully this makes sense and I explained somewhat clearly...
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Finding two sub-strings within a string

    Howdy....just checking to see if this helped

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to Get all Strings Except last string in comma sepated string
    By narasappaj in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-20-2014, 07:05 AM
  2. [SOLVED] problem finding string using .find method when string to be found contains ~ (a tilde)
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2013, 07:38 AM
  3. Replies: 9
    Last Post: 12-21-2012, 04:18 AM
  4. Replies: 6
    Last Post: 03-08-2012, 10:35 AM
  5. Finding Start Position of string in list of strings
    By longfisher in forum Excel General
    Replies: 5
    Last Post: 05-25-2007, 10:34 PM

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