I checked your previous file learned the concept of Dictionary from your
examples Tried the same achieved the results before 6 seconds. Ya from now
I can say Dictionary is much better than the manual vlookup.
Sub t()
'Doing Variable declaration
Dim Folderpath As String: Folderpath =
"C:\Users\Mandeep.baluja\Desktop\Reports Manipulation\"
Dim Fname1 As String
Dim Fname2 As String
Dim Fname3 As String
Dim Fname4 As String
Dim Fname5 As String
Dim wb As Workbook 'Master workbook'
Dim wc As Workbook 'Dump'
Dim nrows As Long 'A variable to hold last row of dump sheet'
'Timer to calculate time
Start = Timer
'Giving files names
Fname1 = "Test1.xlsx"
Fname2 = "Test2.xlsx"
Fname3 = "Test3.xlsx"
Fname4 = "Test4.xlsx"
Fname5 = "Test5.xlsx"
'Assigning it to master workbook
Set wb = ThisWorkbook
Txt = Folderpath & Fname1
'Opening a particular workbook
Set wc = Workbooks.Open(Txt)
'Create a dictionary object
Set DIC_ID = CreateObject("Scripting.dictionary")
'Clearing dictionary
DIC_ID.RemoveAll
nrows =
Application.WorksheetFunction.CountA(wc.Sheets(1).Range("A2:A1000000"))
For i = 2 To nrows
'Filling dictionary object
If (Not DIC_ID.exists(wc.Sheets(1).Cells(i, 1).Value)) Then
DIC_ID.Add wc.Sheets(1).Cells(i, 1).Value,
wc.Sheets(1).Cells(i, 5).Value
End If
Next
'Getting values to Current Sheet
lr = wb.Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lr
wb.Sheets(1).Cells(i, 2) = DIC_ID.Item(wb.Sheets(1).Cells(i,
1).Value)
Next
MsgBox Format((Timer - Start) / 86400, "hh:mm:ss")
End Sub
Regards,
Mandeep Baluja
On Monday, November 9, 2015 at 5:39:30 PM UTC+5:30, Paul Schreiner wrote:
>
> What format are the original (5) files in?
> Are they text, csv, or excel files?
>
> What is the relationship between the 90,000 records and the other 5 files?
> That is, do the records show up once in the list of 90,000 and show up
> multiple times in the 5 files?
> What are the "key" field? (those in common that "relate" the two records?)
> For instance, an "Order Number", or ??
>
> First: for a set of records of this size, I would NOT use vlookup.
> The problem with vlookup is that it executes each time a "calculation" is
> done on the workbook, even though it already has an answer.
>
> So, if you have 90,000 vlookups, and change the heading, it executes
> 90,000 times.
>
> I would definitely use a Dictionary object.
>
> HOW I'd use it would depend on the relationship between the files
>
> If you could send me some sample files, I'd be glad to throw something
> together for you to look at.
>
> *Paul*
> -----------------------------------------
>
>
>
>
>
>
>
> *“Do all the good you can,By all the means you can,In all the ways you
> can,In all the places you can,At all the times you can,To all the people
> you can,As long as ever you can.” - John Wesley*
> -----------------------------------------
>
> ------------------------------
> *From:* Mandeep Baluja <[email protected] <javascript:>>
> *To:* MS EXCEL AND VBA MACROS <[email protected] <javascript:>>
> *Sent:* Monday, November 9, 2015 5:22 AM
> *Subject:* $$Excel-Macros$$ Query for Paul
>
> Hi Paul,
>
> I need your Suggestion Basically I have a master file having Approx 90,000
> Orders no in this Sheet. From 5 Files I need to fetch the Data
> Corresponding to that Orders nos Ya Columns value, Each file has specific
> data related to master Orders nos, Manual Vlookup i can use I know that to
> get the data from files, Now I want to automate this process Which is the
> fastest way to get the data from all file Please suggest the correct one
>
> 1. Whether i should use vlookups in the VBA to get the data present in
> others files corresponding to order no,
> 2. Do i need to use Loops for efficient checking of data
> 3. Should i use Dictionary object and store the orders no and use this
> techniques.
>
> I know how to do this but Still looking for the faster one.
>
> Regards,
> Mandeep baluja
> --
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
> https://www.facebook.com/discussexcel
>
> FORUM RULES
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>
> NOTE : Don't ever post confidential data in a workbook. Forum owners and
> members are not responsible for any loss.
> ---
> You received this message because you are subscribed to the Google Groups
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected]
> <javascript:>.
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
https://www.facebook.com/discussexcel
FORUM RULES
1) Use concise, accurate thread titles. Poor thread titles, like Please Help,
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
NOTE : Don't ever post confidential data in a workbook. Forum owners and
members are not responsible for any loss.
---
You received this message because you are subscribed to the Google Groups "MS
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.