+ Reply to Thread
Results 1 to 5 of 5

Find 2nd, 3rd, 4th instance in list

Hybrid View

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    Rockhampton, Australia
    MS-Off Ver
    Excel 2010
    Posts
    16

    Find 2nd, 3rd, 4th instance in list

    Hi this should be pretty simple using Vlookup/other formula. But i just can't remember how to do it. I want to find multiple instances of the same table:

    Risk Dependancy
    1 D1
    2 D2
    3 D1
    4 D5
    5 D7
    6 D3
    7 D8
    8 D3
    9 D4
    10 D1

    So i want to see D1, is associated with 3 risks = #1, #3 & #10. And so on down the list of dependancies.
    Thanks in advance.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,103

    Re: Find 2nd, 3rd, 4th instance in list

    Add filter to first row and filter out D1 (or anything you like).
    Never use Merged Cells in Excel

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Find 2nd, 3rd, 4th instance in list

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    Function Clookup(LValue As Range, LRng As Range, _
        ResRng As Range, Optional sopSep As String = ", ") As String
    Dim i As Long, sTemp As String
    
    If WorksheetFunction.CountIf(LRng, LValue.Value) Then
        For i = 1 To LRng.Cells.Count
            If LRng.Cells(i).Value = LValue.Value Then
                sTemp = sTemp & ResRng.Cells(i).Value & sopSep
            End If
        Next i
    End If
    
    If Len(sTemp) Then Clookup = Left(sTemp, Len(sTemp) - Len(sopSep))
    
    End Function

    A
    B
    1
    #
    Name
    2
    1
    D1
    3
    2
    D2
    4
    3
    D1
    5
    4
    D5
    6
    5
    D7
    7
    6
    D3
    8
    7
    D8
    9
    8
    D3
    10
    9
    D4
    11
    10
    D1



    C
    D
    1
    Search Value
    Formula Result
    2
    D1
    1, 3, 10



    D
    2
    =Clookup(C2,B2:B12,A2:A12,", ")


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Find 2nd, 3rd, 4th instance in list

    Find the attached sheet to see the formula based solution.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Registered User
    Join Date
    03-19-2013
    Location
    Rockhampton, Australia
    MS-Off Ver
    Excel 2010
    Posts
    16

    Talking Re: Find 2nd, 3rd, 4th instance in list

    thanks everyone.

+ 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. [SOLVED] To Find every instance of TEXT copy, repeat until no Find found
    By DadaaP in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2013, 02:15 PM
  2. VLookup to find next instance
    By s_t_e_i_n in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-28-2012, 11:34 AM
  3. Find first instance of a number after a value
    By jhayes in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-27-2008, 02:59 PM
  4. Find the First Instance of a Number
    By Phillycheese5 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-18-2008, 10:59 AM
  5. Find first and last instance
    By Gixxer_J_97 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2005, 03:35 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