+ Reply to Thread
Results 1 to 4 of 4

Match function

Hybrid View

lvsmr2 Match function 07-22-2009, 12:42 AM
windknife Re: Match function 07-22-2009, 02:22 AM
lvsmr2 Re: Match function 07-22-2009, 02:28 AM
pike Re: Match function 07-22-2009, 04:43 PM
  1. #1
    Registered User
    Join Date
    07-22-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    26

    Smile Match function

    Hi everyone,

    I need some help with the match function. I have attached a spreadsheet with has the following:

    1. on the left hand side is the data we have collected
    2. on the right hand side is where we need the match data to work ie under the column F with a1, we need the have all the data from the left hand side that matches a1 to be listed here, etc for all the other columns after. Hope that makes sense. If you need to ask me any more detail, just let me know. Thanks in advance for your help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,904

    Re: Match function

    Try this,

    F3
    =IF(ROWS($A$2:A2)<=COUNTIF(Sheet1!$B$2:$B$100,F$2),INDEX($A:$A,SMALL(IF($B$2:$B$100=F$2,ROW($A$2:$A$100),""),ROWS($A$2:A2))),"")
    committed with Ctrl+Shift+Enter, then copied down.

    You can also see attached.
    Hope this helps,
    windknife
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-22-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Match function

    Hi,

    Thanks heaps for your help, works great. Greatly appreciated.

    Cheers

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Match function

    another option

    Option Explicit
    Sub ptest()
        Dim found  As Range, LookFor$, fAddress$, i!, ii!
        [F3:V27].ClearContents
        [A1].Activate
        With Worksheets(1).Range("B1", Range("B" & Rows.Count).End(xlUp))
            For ii = 0 To 16 Step 2
                LookFor = [F2].Offset(0, ii)
                Set found = .Find(LookFor, LookIn:=xlValues)
                i = 1
                If Not found Is Nothing Then
                    fAddress = found.Address
                    Do
                        [F2].Offset(i, ii + 0) = found.Offset(0, -1)
                        i = i + 1
                        Set found = .FindNext(found)
                    Loop While Not found Is Nothing And found.Address <> fAddress
                End If
            Next ii
        End With
    End Sub
    but using excel functions where possible is allways the first choice
    Last edited by pike; 07-22-2009 at 04:46 PM. Reason: add ii
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

+ 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