Worksheet Count Function Help

94mustang

Board Regular
Joined
Dec 13, 2011
Messages
133
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Excel Worksheet Function Experts,

The table below is an example of what I am trying to COUNT. When a single project (Project1 below) has a Work Item that is “Process Complete” AND Proj Status is “Completed” AND Work Item is “Logo Returned” AND Proj Status for the Logo Returned is “Canceled” OR “Completed”, how do I get it to count as a single value of 1? Other Software is generating this table of data and I need to use one or multiple functions to develop a table that will provide a total number of projects that have been completely manufactured. In other words, when I have the conditions in blue text met for a single project, I would like to count this as a value of 1 so the formula will total the number of projects. Project3 is another example but may not have the “Canceled” portion for Logo Returned in the Proj Status column. Any help would certainly be greatly appreciated.

Can this formula be made into one cell to calculate a total? I would prefer not to have a formula in every cell next to the row if at all possible. However, if formulas are needed on every row, I am okay with that too.

Proj Name<o:p></o:p>
Work Item<o:p></o:p>
Proj Status<o:p></o:p>
Project1<o:p></o:p>
Process Complete<o:p></o:p>
Completed<o:p></o:p>
Project2<o:p></o:p>
Shipped<o:p></o:p>
Cancelled<o:p></o:p>
Project3<o:p></o:p>
Logo Returned<o:p></o:p>
Completed<o:p></o:p>
Project2<o:p></o:p>
Issued<o:p></o:p>
Not Started<o:p></o:p>
Project3<o:p></o:p>
Process Complete<o:p></o:p>
Completed<o:p></o:p>
Project1<o:p></o:p>
Logo Returned<o:p></o:p>
Canceled<o:p></o:p>
Project1<o:p></o:p>
Logo Returned<o:p></o:p>
Completed<o:p></o:p>

<TBODY>
</TBODY>
<o:p></o:p>
 
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi,

As far as I understand you the furmula you need might bethe following:
Code:
=COUNTIFS(B2:B8,"Process Complete",C2:C8,"Completed")+COUNTIFS(B2:B8,"Logo returned",C2:C8,"Completed")+COUNTIFS(B2:B8,"Logo returned",C2:C8,"Canceled")

From the example you should be able to figure out how to modify it to suit your needs.

Best,

J.Ty.
 
Upvote 0
Hi,

It's unclear to me from your description what your desired results are for that table.

Regards
 
Upvote 0
Add the following two functions coded in VBA to your workbook, using Alt+F11...

Function ArrayUnion(ParamArray Arg() As Variant) As Variant
' Code: Juan Pablo González
' Spec: Aladin Akyurek
' May 4, 2003
' Ref: TinyURL.com - shorten that long URL into a tiny URL
Dim TempUnion() As Variant
Dim i As Long, Itm As Variant, Ctr As Long
For i = LBound(Arg) To UBound(Arg)
Arg(i) = Arg(i)
If IsArray(Arg(i)) Then
For Each Itm In Arg(i)
Ctr = Ctr + 1
ReDim Preserve TempUnion(1 To Ctr) As Variant
TempUnion(Ctr) = Itm
Next Itm
Else
Ctr = Ctr + 1
ReDim Preserve TempUnion(1 To Ctr) As Variant
TempUnion(Ctr) = Arg(i)
End If
Next i
ArrayUnion = TempUnion
End Function


Public Function V(Optional vrnt As Variant) As Variant
'
' Stephen Dunn
' 2002-09-12
'
Static vrntV As Variant
If Not IsMissing(vrnt) Then vrntV = vrnt
V = vrntV
End Function

Now invoke...

Control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(v(arrayunion(IF($B$2:$B$8="Process Complete",
  IF($C$2:$C$8="Completed",$A$2:$A$8)),IF($B$2:$B$8="Logo Returned",
  IF($C$2:$C$8="Completed",$A$2:$A$8)),IF($B$2:$B$8="Logo Returned",
  IF($C$2:$C$8="Canceled",$A$2:$A$8))))<>FALSE,MATCH(v(),v(),0)),
  ROW(INDIRECT("1:"&COUNTA(v()))))=3,1))

@J.Ty.
I believe the count should be 1.
 
Upvote 0
XOR LX,

The desired results are to provide a single value for how many projects have been completely manufactured. As another way to state it, the following conditions must be true in order for it to be a value of 1.
Project1 = Process Complete under Work Item is true and Completed under Proj Status is true and Logo Returned under Work Item is true and Completed under Proj Status is true and Logo Returned under Work Item and Canceled under Proj Status is true.

A table may be better to understand. All the following conditions must be true in order for the Project to count as a value of 1. There can be a situation where Logo Returned is Canceled but I still want to be able to count the Project1 as a value of 1. The data that is imported from the other software can be any number of rows long. I have been trying to use COUNTIFS to do this but no success yet. I may try using an If-Then statement with the COUNTIFS function to see if I can get something. I hope this better explains what I am trying to accomplish. Let me know if you need further explanation.

Proj NameWork ItemProj Status
Project1Process CompleteCompleted
Project1Logo ReturnedCompleted
Project1Logo ReturnedCanceled

<tbody>
</tbody>
 
Upvote 0
Thanks. Excellent explanation.

Would it also be possible to have a table of perhaps twenty or so random lines with your expected result so that I can verify any solutions? Obviously it might be an idea to include lines which feature none of the required statuses, if possible.

Regards
 
Upvote 0
XOR LX,

The number of projects considered to be installed would be three (3) in this example (see table below). Tried to highlight the text but not successful. See Proj Count column. It is just showing what to match and count. If you look at 1, 2 and 3 in the Proj Count column, it will match the criteria. My criteria are the following:

Work Item = Process Completed AND Proj Status = Completed for the Process Completed Work Item
Work Item = Logo Returned AND Project Status = Completed or Cancelled for Logo Returned Item

ALL of the above must be true for the project to count as 1.
Again, I hope this table is a better explanation than before.

Proj CountProj NameWork ItemProj Status
1Project1Process CompletedCompleted
Project3ShippedCancelled
2Project5Logo ReturnedCompleted
Project2Process CompletedCompleted
1Project1Logo ReturnedCancelled
Project4Delivery CompleteLate
Project2Logo ReturnedCancelled
1Project1Logo ReturnedCompleted
2Project5Process CompletedCompleted
Project1Description IssuedNot Started
Project4Installation CompleteProposed
3Project6Process CompletedCompleted
2Project5Logo ReturnedCancelled
Project1Ship DateNeeds Attention
Project5Installation CompleteNot Started
3Project6Logo ReturnedCompleted
Project3Installation CompleteNot Started
Project4Logo ReturnedNot Started
Project8Process CompleteLate
Project9Logo ReturnedNeeds Attention

<tbody>
</tbody>
 
Last edited:
Upvote 0
Hi again,

Would it be possible for you to clarify the conditions? It's just that your two statements don't seem consistent, unless I'm misunderstanding:

All the following conditions must be true in order for the Project to count as a value of 1.
Proj Name
Work Item
Proj Status
Project1
Process Complete
Completed
Project1
Logo Returned
Completed
Project1
Logo Returned
Canceled

<TBODY>
</TBODY>

My criteria are the following:

Work Item = Process Completed AND Proj Status = Completed for the Process Completed Work Item
Work Item = Logo Returned AND Project Status = Completed or Cancelled for Logo Returned Item

ALL of the above must be true for the project to count as 1.

Your latest post seems to suggest that you only need two lines in total to be satisfied for a given Project, i.e. with Work Item = Logo Returned, the Project Status can be either Completed or Cancelled.

Whereas the previous post seemed to suggest that you in fact must have three lines in total satisfied, and that, with Work Item = Logo Returned, there must be both a line with Project Status Completed and a separate line with Project Status Cancelled.

Can you please clarify?

Regards
 
Upvote 0
XOR LX,

Your first assessment of the criteria is correct. The first line of course is Work Item = Process Complete with Project Status Completed. The second one would be with Work Item = Logo Returned with Proj Status Completed or Cancelled. It would not be both. Only one or the other. Thanks for continuing to ask questions because this one I think is not so simple. Let me know if I have better clarity in the explanation or made it less confusing. Thanks again.
 
Upvote 0
Thanks.

Can you test this formula, based on a range of B2:D21 (obviously extend if necessary), and get back to me?

=SUMPRODUCT((MMULT(COUNTIFS($B$2:$B$21,$B$2:$B$21,$C$2:$C$21,{"Process Completed","Process Completed","Logo Returned","Logo Returned"},$D$2:$D$21,{"Completed","Completed","Completed","Cancelled"}),{1;1;1;1})>2)/COUNTIF($B$2:$B$21,$B$2:$B$21))


Regards
 
Upvote 0

Forum statistics

Threads
1,215,013
Messages
6,122,694
Members
449,092
Latest member
snoom82

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