+ Reply to Thread
Results 1 to 5 of 5

Searching trough RANGE for any VALUE and excluding specific VALUE from results

  1. #1
    Registered User
    Join Date
    12-09-2009
    Location
    Belgrade
    MS-Off Ver
    Excel 2010
    Posts
    17

    Searching trough RANGE for any VALUE and excluding specific VALUE from results

    I'm trying to search trough a RANGE for cells that contain some data. When data is found, I need to print the corresponding name with found data. Data can be located in two columns for the same name but I don't want to print name twice ... instead I need one name and all cells with data which belong to that name.

    Also I don't want to include TABLE HEADER in search or let's say to skip cells containing specific text.

    I have made a macro named FindNext_Example and I need some tutoring to complete this task.

    Quick illustration of my table:

    Name1 10 days
    Name2 +10 1 week
    Name3 7 days 3 weeks

    I would like to get Debug.Print
    Please Login or Register  to view this content.

    Excell file with complete table and macro is attached, and also I wrote some comments in code to make it easier what are my problems.
    Attached Files Attached Files

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Searching trough RANGE for any VALUE and excluding specific VALUE from results

    Try this:

    Please Login or Register  to view this content.
    Last edited by xladept; 04-26-2020 at 07:56 PM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    12-09-2009
    Location
    Belgrade
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Searching trough RANGE for any VALUE and excluding specific VALUE from results

    Quote Originally Posted by xladept View Post
    Try this:
    I've made one tiny correction because TOTAL was printing as a result (obviously because my comment was TOTAL only without ":" )
    So it now looks like this and it's working

    Please Login or Register  to view this content.
    Because this is beyond my VBA knowledge is it too much to ask You explain me this SELECT CASE thing?

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Searching trough RANGE for any VALUE and excluding specific VALUE from results

    The select case is sort of like an If....Elseif.....Elseif statement but it can be used for many instances (usually three or more) - it checks the value of the designated field and acts accordingly. As you can see, it's being used with an If...Else statement here.

    Please Login or Register  to view this content.
    For a hit in column E a value of "INJURY" makes it skip to another candidate, otherwise it augments the string sets the found range to Column F and repeats.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Searching trough RANGE for any VALUE and excluding specific VALUE from results

    Quote Originally Posted by GOR4N View Post
    I would like to get Debug.Print
    Please Login or Register  to view this content.
    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. Average excluding specific text and sorting results
    By danieloverton1984 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-12-2019, 03:28 PM
  2. Replies: 3
    Last Post: 08-12-2018, 05:04 PM
  3. Replies: 6
    Last Post: 10-31-2017, 02:19 PM
  4. COUNTIFS; Excluding Columns, And Counting Between Specific Date Range...
    By Haslami in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-31-2017, 12:44 PM
  5. VBA Macro for searching trough list and return values
    By Claeske in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2015, 08:03 AM
  6. [SOLVED] Searching for specific field within range
    By ExcelSponge in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-06-2015, 12:07 PM
  7. Replies: 3
    Last Post: 10-17-2013, 02:26 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