New work project: stuck on Multidimensional Array / Directory

tweedi

New Member
Joined
Feb 13, 2013
Messages
21
Hi All!

I have a database storing all open files and at which phase they currently are (each phase representing a different step in the process e.g Registered / Confirmed / Production / Test / Certified / Dispatched

The aim is to detect when a file goes reach a certain phase and then would be rejected to the previous phase. I attached a simplified example of the database with only 2 open files (they are in reality hundreds of file, the excel spreadsheet has tens of thousands of rows)

Therefore I could summarize in a different sheet the files that reached phase 4 and was rejected to phase 3 (ideally with the date when it was back at phase 3.

Apparently the best way (as I cannot loop it would take forever and crash) is to use arrays and directory but I am a bit stuck here as the values should be stored by pair I think (File ID + Current Status).

Can anyone help with this?
Many Thanks!!

File:

Day CountDateFile IDDescriptionFile Status
126/08/2015800AccidentPhase 3
126/08/2015801TheftPhase 3
227/08/2015800AccidentPhase 3
227/08/2015801TheftPhase 3
328/08/2015800AccidentPhase 3
328/08/2015801TheftPhase 3
429/08/2015800AccidentPhase 4
429/08/2015801TheftPhase 3
530/08/2015800AccidentPhase 3
530/08/2015801TheftPhase 3
631/08/2015800AccidentPhase 3
631/08/2015801TheftPhase 4
701/09/2015800AccidentPhase 3
701/09/2015801TheftPhase 3
802/09/2015800AccidentPhase 3
802/09/2015801TheftPhase 4
903/09/2015800AccidentPhase 3
903/09/2015801TheftPhase 3
1004/09/2015800AccidentPhase 3
1004/09/2015801TheftPhase 3

<colgroup><col><col><col><col span="2"></colgroup><tbody>
</tbody>
 
Last edited:

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi,
couple of suggestions:

1 - you could read your table into an array & use this to filter out the record records which could be copied to another sheet - as an example based on your table:

Code:
Sub aa()
    Dim i As Integer, msg As Integer, FileID As Integer
    Dim RangeData As Variant
    Dim FileStatus As String
    
    FileStatus = "Phase 4"
    
    FileID = 801
    
    With ThisWorkbook.Worksheets("Sheet1")
        'intialize array with data from table
        RangeData = .Range("A2:E" & .Cells(.Rows.Count, "A").End(xlUp).Row).Value
    End With




    For i = LBound(RangeData, 1) To UBound(RangeData, 1)
    
    If RangeData(i, 3) = FileID And RangeData(i, 5) = FileStatus Then
    
    
      msg = MsgBox("Day Count: " & RangeData(i, 1) & Chr(10) & _
                "           Date: " & RangeData(i, 2) & Chr(10) & _
                "         File ID: " & RangeData(i, 3) & Chr(10) & _
                "Description: " & RangeData(i, 4) & Chr(10) & _
                "   File Status: " & RangeData(i, 5), 36, "Array Demo")
            If msg = 7 Then Exit Sub
        
    End If
    
    Next i


End Sub

This would display the msgbox for only those records that equal FileID 801 & FileStatus Phase 4

2 - if your data set is very large, you could consider using advanced filter which probably would be a lot quicker. You would have a criteria sheet to set the filter allowing user to specify which records are required & result can either be filtered in place or copied to another sheet.

If not used advanced filter before have a look here for guidance: http://www.contextures.com/xladvfilter01.html

Hope helpful

Dave
 
Upvote 0

Forum statistics

Threads
1,214,605
Messages
6,120,473
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top