+ Reply to Thread
Results 1 to 3 of 3

Lookup and highlight text in cells with wildcard characters

  1. #1
    Registered User
    Join Date
    08-29-2014
    Location
    Germany
    MS-Off Ver
    Office 2010
    Posts
    1

    Question Lookup and highlight text in cells with wildcard characters

    Hi all,

    I have an Excel sheet with aminoacid sequences represented as text. I want to write a script, that finds and highlights a specific motif in the different sequences. The motif is T.[DE] (or T?D|E) meaning that I'm looking for 3 characters beginning with T, the second character is variable and the third character is either a D or an E. E.g. TFE, TGE, TGD etc.

    For example, my peptide sequence is SVKVPVGVQMNKYVINGTYDNETKLKITQLL, after running the script it should look like this: SVKVPVGVQMNKYVINGTYDNETKLKITQLL. I dont care whether the motif is marked in bold, color etc.

    So as a start, I looked up some scripts with InStr from the internet, which serve their purpose well, as long as you have a normal word without any wildcard characters for the search...since InStr doesn't allow for wildcards. So for example, for the static "TYD" it would work.

    Please Login or Register  to view this content.
    My question is, are there alternatives to ImStr I coud use? If the "either or" [DE] searchterm is a problem I could split the searches into T?D and T?E but I would at least need to use the wildcard ? / . character in the search.
    Thanks in advance

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Lookup and highlight text in cells with wildcard characters

    hi Halulu, welcome to Excelforum, option, please check attachment, select cells to be searched, press "CTRL+SHIFT+M" or run code "test"(ALT+F8, select "test", press Run)

    The code would ask for a pattern to search. The pattern has to be in accordance with regular expressions codex.
    Pattern example:
    T.[DE] - will match any three symbols pattern starting with T having any symbol (letter or number or other signs) on the second place and ending with D or E letters.
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Lookup and highlight text in cells with wildcard characters

    I believe the worksheet function search allows wildcards. So maybe something like:

    Please Login or Register  to view this content.

+ 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. Replies: 12
    Last Post: 01-26-2015, 04:18 AM
  2. EXCEL 2010 create a macro- highlight any cells with more than 30 characters in a column
    By cluelessexcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-19-2013, 11:00 AM
  3. [SOLVED] Highlight cells that are over 100 characters
    By jsz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2013, 10:51 AM
  4. highlight cells that contain the same first 5 characters
    By goldstar1 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-17-2013, 02:24 PM
  5. Counting cells for multiple wildcard text
    By Phillycheese5 in forum Excel General
    Replies: 2
    Last Post: 09-27-2010, 01:11 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