+ Reply to Thread
Results 1 to 3 of 3

ForLoop to Find string value as part of substring in another cell

  1. #1
    Forum Contributor
    Join Date
    08-06-2018
    Location
    Virginia
    MS-Off Ver
    2019
    Posts
    342

    ForLoop to Find string value as part of substring in another cell

    Experts:

    I need some assistance with creating maybe a ForLoop (or DoWhile) in order to find a substring in a cell (e.g., A1). The value to be found is located in cell A10.

    Cell A1:
    - Starting at the left, cell A1 contains the value "XYZ" four times (XYZ + XYZ + XYZ + XYZ = XYZXYZXYZXYZ... without spaces).
    - At the same time, cell A1 also contains the character orders of, e.g., "YZX" 3 times... YZXYZXYZX ... again, without spaces).
    - Further, I also can find the string order = "XYZY" e.g., twice in cell A1.
    - ultimately, depending on the string, there are numerous possibilities for finding a string.

    Let's say now, I enter value "XYZ" into cell A10, I would like to return "4" in B10, given that this combination of letters (XYZ) exists 4 times in A1.
    Alternatively, if I enter "XYZY" into A10, I'd like the count to show a 2.

    My question:
    How can I create either a ForLoop or DoLoop to achieve the accurate count on a sub-string (A1) based on a lookup value in A10?

    Any thoughts/recommendation on how to create the ForLoop? Pls see attached XLS example.
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: ForLoop to Find string value as part of substring in another cell

    Try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    "XYZY" is not an option.

  3. #3
    Forum Contributor
    Join Date
    08-06-2018
    Location
    Virginia
    MS-Off Ver
    2019
    Posts
    342

    Re: ForLoop to Find string value as part of substring in another cell

    PERFECT!!! Thank you... that'll work.

+ 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. Find a value and then return part of the string in the adjacent cell.
    By jimbex in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-05-2021, 08:09 AM
  2. Replies: 8
    Last Post: 03-09-2018, 11:39 AM
  3. Replies: 4
    Last Post: 02-22-2015, 09:52 AM
  4. [SOLVED] Find substring within a string, from a list
    By NotSwank in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-06-2014, 10:27 AM
  5. [SOLVED] Find the position of a substring in a string
    By nemo66ro in forum Excel General
    Replies: 6
    Last Post: 10-22-2012, 01:21 AM
  6. How to check if a string in a cell contains a substring?
    By pablowilks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2012, 04:14 PM
  7. Find the sub string in column and copy the cell next to the substring
    By shrujan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2009, 11:00 AM

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