Home > Software engineering >  Ask a about EXCEL data import array after comparing statistical problems
Ask a about EXCEL data import array after comparing statistical problems

Time:09-26

Such as EXCEL spreadsheet data, 161125161, 130, said in the table is the deadline to finish, I want to realize functions is the statistics of the follow-up work to finish before 161120, and make a summary,
I put these data import ProjData (I, j) array, this is no problem, the previously defined ProjData (1 To 500, 1 To 50) As the Variant,
Then choose the one of fifth column, i.e. ProjData (I, 5) date of more than 161120 data, export the adults, the code is as follows:
 Private Sub Command2_Click () 
Dim SubTotal As an Integer, PDRow (1 To 1 To 500, 500) As the Variant
SubTotal=0
For I=1 To 26
If ProjData (I, 5) & gt; Then=161120
SubTotal=SubTotal + 1
PDRow (SubTotal, 5)=I
The Debug. Print PDRow (SubTotal, 5)
End the If
Next I
End Sub

Why I Debug. Print out data, to identify completed or unfinished, also tallied up?

CodePudding user response:

ProjData (I, 5) & gt;=161120
You see
This is the comparison of the digital
Unfinished is a string, how do you compare type wrong?
If ProjData (I, 5) & gt;=161120, Then change to the
If ProjData (I, 5) & gt;=161120 and instr (ProjData (I, 5), "complete") & lt; 0 Then
Take a look at

CodePudding user response:

 If ProjData (I, 5) & gt;=161120 And IsNumeric (ProjData (I, 5)) Then 

CodePudding user response:

First you ProjData array is defined by the Variant types, and array has words or characters, therefore, the system must have the default for the variables of type String array, you now have to compare the fifth column, and need a number, so it is the fifth column is converted into digital:
If Val (ProjData (I, 5)) & gt; Then=161120
To compared with string:
If ProjData (I, 5) & gt;="161120" Then
Don't you see, not just the logo finished or unfinished, but there is also a less than 161120,

CodePudding user response:

Why not add a column? After the completion of the do not need to see the time?

In general, you should plan completion time, the actual completion time,
  • Related