Results 1 to 2 of 2

Help with looping through index function to get all matches in vba

Threaded View

  1. #1
    Registered User
    Join Date
    07-08-2011
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2013
    Posts
    2

    Help with looping through index function to get all matches in vba

    i have this code:

    Sub Macro1()
        
        Dim ImportDate1, ImportDate2 As String
        
        Range("H453").Select
            
        '=INDEX(Import!$A$2:$O$250000,SMALL(IF(Import!$A:$A=$D$452,ROW($A:$A)),ROW(1:1))-1,15)
        
            Selection.FormulaArray = _
            "=INDEX(Import!R2C1:R250000C15,SMALL(IF(Import!C1=R453C4,ROW(C1)),ROW(R[-452]))-1,15)"
            
            ImportDate1 = Range("H453").Value
            
            Debug.Print ImportDate1
            
            Range("H454").Formula = Range("H453").Formula
            
            Range("H454").Select
            
               Selection.FormulaArray = _
            "=INDEX(Import!R2C1:R250000C15,SMALL(IF(Import!C1=R454C4,ROW(C1)),ROW(R[-452]))-1,15)"
            
            ImportDate2 = Range("H454").Value
            
            Debug.Print ImportDate2
              
        End Sub
    It produces two outputs right now. I need to build a loop to increment the Range("H453") value by one to Range("H454") each time around to display all the results of the index function on the spreadsheet. I tried a loop but can't get the range to increment..

    Thank you

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 12-08-2016 at 08:19 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Return multiple matches using index function
    By sbabu16 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-27-2015, 05:01 AM
  2. Index-Match function not finding matches with newly pasted values
    By murp5972 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-04-2015, 03:44 PM
  3. [SOLVED] Codes for same column with index and match function looping
    By ash3angel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-24-2015, 01:42 AM
  4. [SOLVED] Problems with multiple matches inside an index-function
    By Sidehosw in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-14-2014, 07:53 AM
  5. [SOLVED] Optimizing/speeding up a slow INDEX & SMALL function for retrieving multiple matches
    By lesoies in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-07-2012, 11:56 AM
  6. Replies: 4
    Last Post: 07-18-2012, 02:34 PM
  7. Looping Index and Match Function in VBA
    By Tleong in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-15-2012, 11:50 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