+ Reply to Thread
Results 1 to 10 of 10

Searching for values within a range

Hybrid View

  1. #1
    Registered User
    Join Date
    10-30-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    6

    Searching for values within a range

    I have what im pretty sure is a pretty simple problem to fix. Hoping someone might be able to help.

    I have 9000+ cells all with ranges some of which have over lapping ranges in them such as this:

    Untitled.png
    My question is this:

    Is there a way to bring up everything with the value of "39" in the cells range?

    Sorry if anything sounds convlouted this is my first time asking for help on a forum.

    Thanks for the help guys.

  2. #2
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 365
    Posts
    2,406

    Re: Searching for values within a range

    Describe it with sample workbook please? and the desired result of course

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Searching for values within a range

    
    Sub Select_Select()
    Dim rngFind As Range
        Dim strValueToPick As String
        Dim rngPicked As Range
        Dim rngLook As Range
        Dim strFirstAddress As String
        
    'Select all cells
        Cells.Select
    
    'We will be searching in the active selection    
        Set rngLook = Selection
    
    'We are looking for 39
    'Replace xlwhole with xlpart if you do not want exact match
    
        strValueToPick = "39"
        With rngLook
            Set rngFind = .Find(strValueToPick, .Cells(1, 1), LookIn:=xlValues, lookat:=xlWhole)
            If Not rngFind Is Nothing Then
                strFirstAddress = rngFind.Address
                Set rngPicked = rngFind
                Do
                    Set rngPicked = Union(rngPicked, rngFind)
                    Set rngFind = .FindNext(rngFind)
                Loop While Not rngFind Is Nothing And rngFind.Address <> strFirstAddress
            End If
        End With
    
    'this selects the cells    
        If Not rngPicked Is Nothing Then
            rngPicked.Select
        End If
    
    End Sub

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Searching for values within a range

    I can select every cell with 39 in it.

    The question is do you want exact matches only?

    Do you want to select the whole row or specific cells

    Having selected them what do you want to do ?

  5. #5
    Registered User
    Join Date
    10-30-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Searching for values within a range

    Quote Originally Posted by mehmetcik View Post
    I can select every cell with 39 in it.

    The question is do you want exact matches only?

    Do you want to select the whole row or specific cells

    Having selected them what do you want to do ?
    I would like to bring up everything that contains a certain value. Looking for x would bring up anything containing or equaling x.

    The selection of the whole row is what im looking to bring up and find.

    All i need to do is to find them in the sheet.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Searching for values within a range

    Hi and welcome to the forum

    have you taken a look at using filters on your data? Look on the Home tab/Editing/Sort and Filter
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Searching for values within a range

    Bring up how?

    With conditional formatting:

    format in range.xlsx

  8. #8
    Registered User
    Join Date
    10-30-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Searching for values within a range

    Quote Originally Posted by daffodil11 View Post
    Bring up how?

    With conditional formatting:

    Attachment 274657
    Thats actually extremly close to what im looking for. how exactly would i be able to do that for a column of ranges instead of a table?

  9. #9
    Registered User
    Join Date
    10-30-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Searching for values within a range

    Quote Originally Posted by daffodil11 View Post
    Bring up how?

    With conditional formatting:

    Attachment 274657
    Thanks so much guys, i was just saved hours of research. I managed to adopt this formatting into my sheet and it worked axactly as desired!

    THANKS :D

  10. #10
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Searching for values within a range

    Woo Woo! Glad I could help out.

    It was conditionally formatted to

    =AND($C$3>=TRIM(MID(SUBSTITUTE(B15," - ",REPT(" ",100)),1,100))*1,$C$3<=TRIM(MID(SUBSTITUTE(B15," - ",REPT(" ",100)),100,100))*1)

    Where C3 was the value you're looking up
    Last edited by daffodil11; 10-31-2013 at 12:34 PM.

+ 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. Searching for a range of values in a column and selecting them
    By AggyRJ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2013, 02:45 PM
  2. Searching for user defined value in range, sending only these values to array ERROR
    By sgonzalez90 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2013, 01:02 AM
  3. Searching a range of values for outliers
    By kurifodo in forum Excel General
    Replies: 4
    Last Post: 05-22-2011, 06:20 PM
  4. Searching for values within a string across a range of cells
    By futureboy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-22-2010, 07:53 PM
  5. VBA -searching using range of values
    By ACOM in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-16-2009, 02:36 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