+ Reply to Thread
Results 1 to 2 of 2

VBA Index/Match multiple criteria

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-08-2012
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    190

    VBA Index/Match multiple criteria

    This is what i ahve have..it works great with only one criteria

    Sub SampleLoop2()
    
    'On Error Resume Next
    
    Const sSSName As String = "Labels"
    Const Locality As String = "Locality Info"
    Dim sh As Worksheet
    Dim lLR As Long
    Dim i As Long
    Dim r As Long
    Dim sq As Long
    Dim result1 As Variant
    Dim result2 As Variant
    Dim result3 As Variant
    Dim result4 As Variant
    Dim result5 As Date
    Dim result6 As Variant
    Dim Loc As Range
    Set Loc = Sheets("Locality Info").Range("A:F")
    
    For Each sh In ThisWorkbook.Worksheets
            If sh.Name <> sSSName Then ' if the sheet doesnt equal label sheet
            If sh.Name <> Locality Then
                
                r = sh.Range("F" & sh.Rows.Count).End(xlUp).Row
                        For i = 4 To r
                            lLR = Sheets(sSSName).Range("B" & Sheets(sSSName).Rows.Count).End(xlUp).Row + 1 'bottom row on the labels sheet
                            
                                    result1 = Application.WorksheetFunction.VLookup(sh.Range("F" & i), Loc, 4, False)
                                    result2 = Application.WorksheetFunction.VLookup(sh.Range("F" & i), Loc, 5, False)
                                    result3 = Application.WorksheetFunction.VLookup(sh.Range("F" & i), Loc, 1, False)
                                    result4 = Application.WorksheetFunction.VLookup(sh.Range("F" & i), Loc, 3, False)
                                    result5 = Application.WorksheetFunction.VLookup(sh.Range("F" & i), Loc, 2, False)
                                    result6 = Application.WorksheetFunction.VLookup(sh.Range("F" & i), Loc, 6, False)
                                    
                                    Sheets(sSSName).Range("B" & lLR).Value = result1 & ": " & result2 & " Co." & Chr(10) & _
                                                                             result3 & Chr(10) & _
                                                                             result4 & Chr(10) & _
                                                                             Format(result5, "dd MMM yyyy") & Chr(10) & _
                                                                             result6 & Chr(10)
                                    
    
                                                                             lLR = lLR + 1
                            End With
    
    
                        Next 'i
            End If 'sh.Name
            End If
    Next 'sh
    
    End Sub
    Now that i ahve collected data from teh same areas the lookup range ("F" & i) has the same data present but the next column ("G" & i) has the coresponding data that i went out

    waht i need is for this to Use both Column F and G to find the values

    here is the worksheet

    Collection Sheet1.xlsm

  2. #2
    Forum Contributor
    Join Date
    12-08-2012
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    190

    Re: VBA Index/Match multiple criteria

    anyone able to help?

+ 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. Index/Match with multiple criteria
    By ccwynar in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-27-2014, 06:25 PM
  2. Index Match using multiple criteria
    By sarahataylor in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-12-2014, 06:42 AM
  3. Index and match with multiple criteria
    By felixpanganiban in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-04-2012, 01:06 PM
  4. Index & Match with Multiple criteria
    By connollet in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-03-2012, 03:07 PM
  5. VBA Multiple Criteria Index Match
    By blablah in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2012, 07:49 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