Results 1 to 7 of 7

Huge data index/match replacement

Threaded View

teireii Huge data index/match... 07-26-2017, 05:43 AM
AliGW Re: Huge data index/match... 07-26-2017, 05:44 AM
karedog Re: Huge data index/match... 07-26-2017, 08:25 AM
teireii Re: Huge data index/match... 07-26-2017, 11:41 PM
karedog Re: Huge data index/match... 07-27-2017, 12:07 PM
teireii Re: Huge data index/match... 07-30-2017, 11:17 PM
karedog Re: Huge data index/match... 07-31-2017, 03:33 AM
  1. #5
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Huge data index/match replacement

    You are welcome.
    Of course the macro on post #3 won't work for your newest file on post #4, they have different layout.
    This is the macro for your newest file on post #4 :
    Sub Test()
      Dim rng As Range, arrDec, arrCon, arrTop, arrLeft, i As Long, j As Long, p1 As Long, p2 As Long, startTime As Single, endTime As Single
    
      'Log start timer
      startTime = Timer
    
      'Get arrays
      arrDec = Sheets("decimal").Range("A1").CurrentRegion.Value
      With Sheets("Cty Contracts").Range("A1").CurrentRegion
        Set rng = .Range("E2:" & Split(.Address, ":")(1))
        arrCon = Sheets("Contract").Range(rng.Address).Value
        arrTop = rng.Offset(-1).Resize(1).Value
        arrLeft = rng.Offset(, -rng.Column + 1).Resize(, 1).Value
      End With
    
      'Change items to be matched to uppercase
      For i = 1 To UBound(arrDec, 1): arrDec(i, 1) = UCase$(arrDec(i, 1)): Next i
      For i = 1 To UBound(arrDec, 2): arrDec(1, i) = UCase$(arrDec(1, i)): Next i
      For i = 1 To UBound(arrTop, 2): arrTop(1, i) = UCase$(arrTop(1, i)): Next i
      For i = 1 To UBound(arrLeft, 1): arrLeft(i, 1) = UCase$(arrLeft(i, 1)): Next i
    
      'Get index
      For i = 1 To UBound(arrTop, 2)
          For j = 1 To UBound(arrDec, 2)
              If arrTop(1, i) = arrDec(1, j) Or Left$(arrTop(1, i), 12) = arrDec(1, j) Then arrTop(1, i) = j: Exit For
          Next j
          If Not IsNumeric(arrTop(1, i)) Then arrTop(1, i) = 0
      Next i
      For i = 1 To UBound(arrLeft, 1)
          For j = 1 To UBound(arrDec, 1)
              If arrLeft(i, 1) = arrDec(j, 1) Then arrLeft(i, 1) = j: Exit For
          Next j
          If Not IsNumeric(arrLeft(i, 1)) Then arrLeft(i, 1) = 0
      Next i
    
      'Calc
      For i = 1 To UBound(arrCon, 1)
          p1 = arrLeft(i, 1)
          If p1 > 0 Then
             For j = 1 To UBound(arrCon, 2)
                 p2 = arrTop(1, j)
                 If p2 > 0 Then
                    arrCon(i, j) = arrCon(i, j) / arrDec(p1, p2)
                 End If
             Next j
          End If
      Next i
    
      'Write output
      Application.ScreenUpdating = False
        rng.Resize(UBound(arrCon, 1), UBound(arrCon, 2)).Value = arrCon
      Application.ScreenUpdating = True
      
      'Log end timer
      endTime = Timer
      Debug.Print (endTime - startTime) & " seconds have passed [VBA]"
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. index-match between two huge files
    By is2_egypt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-15-2016, 09:59 AM
  2. [SOLVED] vba replacement for index match array
    By eculver in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2015, 05:39 PM
  3. Problems applying INDEX-MATCH-MATCH function on other data
    By LennartB in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-13-2015, 05:33 AM
  4. Replies: 1
    Last Post: 03-21-2015, 07:46 PM
  5. Replies: 2
    Last Post: 08-30-2014, 02:49 AM
  6. Replies: 3
    Last Post: 05-08-2013, 02:10 PM
  7. Huge replacement formula
    By Falcon Punch in forum Excel General
    Replies: 7
    Last Post: 12-01-2011, 06:10 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