+ Reply to Thread
Results 1 to 2 of 2

matching and returning results

  1. #1
    Registered User
    Join Date
    05-11-2006
    Posts
    1

    Angry matching and returning results

    Hello,
    I need assistance in creating a formula/string to return all location results (into individiual cells) based on search criteria. Please see example.

    Location Item Item Item
    A 100 400
    B 400
    C 400 100
    D 300
    E 200 100
    F 200
    G 100
    H 100 300
    I 200 300 100
    Search Results
    100 A C E G H I
    200 E F I
    300 D H I
    400 A B C

    Thank you in advance!

  2. #2
    Otto Moehrbach
    Guest

    Re: matching and returning results

    If I understand correctly what you want, the following macro will do that
    for you. I assumed your data starts with A1 and goes down and to the right,
    with location in Column A. The search criteria (4 cells in a column with
    100, 200, 300, and 400 in them) is in B11:B14. Watch out for line wrapping
    of the code in this message. View this in full screen. If you wish, send
    me an email with a valid email address for you and I'll send you the small
    file I made up for this. Mention in your message that the file is named "Oh
    Canada.xls". My email address is [email protected]. Remove the "nop"
    from this address. HTH Otto
    Sub SearchData()
    Dim RngColA As Range
    Dim i As Range
    Dim RngRow As Range
    Dim SearchCr As Range
    Dim j As Range
    Set SearchCr = Range("B11:B14")
    Set RngColA = Range("A1", Range("A" & Rows.Count).End(xlUp))
    For Each i In SearchCr
    For Each j In RngColA
    Set RngRow = Range(j.Offset(, 1), Cells(j.Row, Columns.Count))
    If Not RngRow.Find(What:=i.Value, LookAt:=xlWhole) Is Nothing
    Then _
    Cells(i.Row, Columns.Count).End(xlToLeft).Offset(, 1) =
    j.Value
    Next j
    Next i
    End Sub

    "ob_canada" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello,
    > I need assistance in creating a formula/string to return all location
    > results (into individiual cells) based on search criteria. Please see
    > example.
    >
    > Location Item Item Item
    > A 100 400
    > B 400
    > C 400 100
    > D 300
    > E 200 100
    > F 200
    > G 100
    > H 100 300
    > I 200 300 100
    > Search Results
    > 100 A C E G H I
    > 200 E F I
    > 300 D H I
    > 400 A B C
    >
    > Thank you in advance!
    >
    >
    >
    > --
    > ob_canada
    > ------------------------------------------------------------------------
    > ob_canada's Profile:
    > http://www.excelforum.com/member.php...o&userid=34339
    > View this thread: http://www.excelforum.com/showthread...hreadid=541073
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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