Closed Thread
Results 1 to 5 of 5

faster find method

  1. #1
    Registered User
    Join Date
    09-16-2005
    Location
    Bangalore, India
    Posts
    47

    Unhappy faster find method

    Hello,

    Please look at the screen print attached of the form that I designed...

    This is the search screen to search the database (Shared Excel Workbook)

    My problem is that every time I search, it takes approximately 3 minutes to produce the results... Please suggest me a faster method to search through the workbook.

    Database (Workbook): This is a separate shared excel workbook with 1 worksheet for each user (25 now). Each worksheet contains 45 columns of data

    Structure: Everytime a request comes in to the organization,
    1. Recorded and stored under the users worksheet as 1 row of data
    2. Second person searches for all the records and allocates it to a 3rd person
    3. Person 3 searches for all records allocated to him and resolves the request

    every action performed on the record creates a new row of data with system date and time stamp on it. Record number is the only UNIQUE IDENTIFIER for all these records (<>0).

    Search screen: As you can see from the attached picture, a lot of options are provided to the user to search speccific results.

    Current Search method:
    1. Load all the existing data to an array - Each column of data is loaded on to a separate array
    2. To eliminate the multiple records, date and time stamp is compared and all records but the latest are marked (unique record number is made as 0)
    ----
    Option Base 1
    ----
    For I = 1 to LastRow
    For J = I+1 to LastRow
    IF UniqueNumberArray(I)=UniqueNumberArray(J) then
    if DateTimeArray(I) > DateTimeArray(J) then
    DateTimeArray(J)="0"
    Else: DateTimeArray(I)="0"
    End if
    End if
    Next J
    Next I
    ----
    3. Compare each record to values selected on the search screen with respective array elements
    For I = 1 to LastRow
    If not UniqueNumberArray(I)= "0" then
    If not SourceArray(I) = SelectedSource then UniqueNumberArray(I) = "0"
    End if
    If not UniqueNumberArray(I)= "0" then
    If not TypeArray(I) = SelectedSource then UniqueNumberArray(I) = "0"
    End if
    Next I

    4. Dump array back on to a blank sheet
    For I = 1 to LastRow
    If not UniqueNumberArray(I)= "0" then
    Cells(I,1)=UniqueNumberArray(I)
    Cells(I,2)=SourceArray(I)
    Cells(I,3)=TypeArray(I)
    End if
    Next I

    5. Load List box with result range
    ------------------------------------------------------
    I know there are multiple For loops which is making the process slow...

    I thought of sorting the array to ease the search... but, due to multiple arrays that cannot be possible...

    If i make a single multidimentional array instead of multiple single dimentioal array, there is no way to sort a multidimentional array in place (quick sort, sorts only 1 dim array)

    I cannot sort and delete rows on a worksheet (instead of arrays) because data from all 25 users exceeds 65000 lines

    I need to bring this down to a max search wait time of 10 seconds
    ------------------------------------------------------
    Any help is greatly appriciated....
    Attached Files Attached Files
    Thanks,
    Baapi

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Please read the forum rules below. Title does amending and code needs to be wrapped

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    09-16-2005
    Location
    Bangalore, India
    Posts
    47
    Hello,

    Please look at the screen print attached of the form that I designed...

    This is the search screen to search the database (Shared Excel Workbook)

    My problem is that every time I search, it takes approximately 3 minutes to produce the results... Please suggest me a faster method to search through the workbook.

    Database (Workbook): This is a separate shared excel workbook with 1 worksheet for each user (25 now). Each worksheet contains 45 columns of data

    Structure: Everytime a request comes in to the organization,
    1. Recorded and stored under the users worksheet as 1 row of data
    2. Second person searches for all the records and allocates it to a 3rd person
    3. Person 3 searches for all records allocated to him and resolves the request

    every action performed on the record creates a new row of data with system date and time stamp on it. Record number is the only UNIQUE IDENTIFIER for all these records (<>0).

    Search screen: As you can see from the attached picture, a lot of options are provided to the user to search speccific results.

    Current Search method:
    1. Load all the existing data to an array - Each column of data is loaded on to a separate array
    2. To eliminate the multiple records, date and time stamp is compared and all records but the latest are marked (unique record number is made as 0)
    ----
    Please Login or Register  to view this content.
    ----
    3. Compare each record to values selected on the search screen with respective array elements
    Please Login or Register  to view this content.
    4. Dump array back on to a blank sheet

    Please Login or Register  to view this content.
    5. Load List box with result range
    ------------------------------------------------------
    I know there are multiple For loops which is making the process slow...

    I thought of sorting the array to ease the search... but, due to multiple arrays that cannot be possible...

    If i make a single multidimentional array instead of multiple single dimentioal array, there is no way to sort a multidimentional array in place (quick sort, sorts only 1 dim array)

    I cannot sort and delete rows on a worksheet (instead of arrays) because data from all 25 users exceeds 65000 lines

    I need to bring this down to a max search wait time of 10 seconds
    ------------------------------------------------------
    Any help is greatly appriciated....

  4. #4
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    The best way to fix your problem is to write data in Ms Access in transparent mode. You continue to use excel but write data in an Access File.

    In this mode, it's enough to do a query to obtain records sorted by UniqueNumberArray and DateTimeArray to avoid to select last records.

    You can also do a a query to compare records with your criteria and then you can write the query result records in your excel file to populate your listbox.

    It's not very easy to do, but it's very faster than work in excel.

    Regards,
    Antonio

  5. #5
    Registered User
    Join Date
    09-16-2005
    Location
    Bangalore, India
    Posts
    47
    Thanks, But I've got no option but Excel...

Closed 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