I only know VBa (I don't really know workbook functions) so since you don't specify which you want, this VBa should do what you want
Sub UpdateStatus()
Dim row As Integer
row = 2 ' sets the starting row
Dim statisticRow As Integer
statisticRow = 2
Do While (True) ' we must reset everything before we go on our quest. Be gone foul witch
If Range("F" & statisticRow).Value = "" Then
Exit Do
End If
Range("F" & statisticRow).Value = ""
Range("G" & statisticRow).Value = ""
Range("H" & statisticRow).Value = ""
statisticRow = statisticRow + 1
Loop
Do While (True)
Dim currentValue As String
currentValue = Range("A" & row).Value
Dim otherValue As String
If currentValue = "" Then
Exit Do
End If
Dim otherRow As Integer
otherRow = 2 ' sets the starting row where the results are
Do While (True) ' find it or add it
otherValue = Range("F" & otherRow).Value
Dim currentValueStatus As String
If otherValue = "" Then
currentValueStatus = Range("B" & row).Value
Range("F" & otherRow).Value = currentValue
If currentValueStatus = "closed" Then
Range("H" & otherRow).Value = 1
End If
If currentValueStatus = "PENDING" Then
Range("G" & otherRow).Value = 1
End If
Exit Do
End If
If currentValue = otherValue Then ' Good news sire, I found it
currentValueStatus = Range("B" & row).Value
If currentValueStatus = "closed" Then
Range("H" & otherRow).Value = Range("H" & otherRow).Value + 1
End If
If currentValueStatus = "PENDING" Then
Range("G" & otherRow).Value = Range("G" & otherRow).Value + 1
End If
Exit Do
End If
otherRow = otherRow + 1
Loop
row = row + 1
Loop
End Sub
Before
And after I run the macro
As you can see, it will automatically put in the company names for you, and work out how many of each exist. This means, if you added a new company and ran the macro again, it will be updated with the new detail without any change to the code.
3Make sure you use proper formatting when asking questions, very hard to read otherwise. Also, what exactly do you want from this? You have multiple projects with the same name according to your data. Eg;
VIVA
appears 3 times, twice is labelled asclosed
, once its labelled asPENDING
– Jonny Wright – 2014-06-07T13:49:42.487