Mar 01 2022 07:24 AM
Hi, good afternoon.
I'm facing a problem that I don't really know how to solve. I have a file with thousands of rows including Job IDs and agent names. The same job ID can appear many times, sometimes under the same agent, sometimes under a different agent. I need to count the number of times that each Job ID occurs for each agent. In the screenshot is an example of how I need it to look.
Job ID 1 gets counted as 2 for John (because it occurs 2 times under his name), and it gets counted as 1 for Sebastian (because it occurs only 1 time under his name). I hope this is clear. Any help is much appreciated
Mar 01 2022 07:35 AM
Solution=IF(COUNTIFS($CX$2:CX2,CX2,$CY$2:CY2,CY2)=1,COUNTIFS($CX$2:$CX$11,CX2,$CY$2:$CY$11,CY2),"")
Is this what you are looking for?
Mar 01 2022 07:38 AM
Mar 01 2022 08:18 AM
@OliverScheurich A followup question if you don't mind.
The formula works in the example table I made, but when I applied it to my actual table, I had to extend the range, because obviously the formula would stop working after the 11th row. When I switched the range to cover the entire formula, it stops working altogether and gives very weird, high values.
In my actual ranges, A=CX, and CM=CY
This is how I applied it to my actual table:
=IF(COUNTIFS($A$2:A2,A2,$CM$2:CM2,CM2)=1,COUNTIFS($A$2:$A:$A,A2,$CM$2:$CM:$CM,CM2),"")
Mar 01 2022 08:39 AM
=IF(COUNTIFS($A$2:A2,A2,$CM$2:CM2,CM2)=1,COUNTIFS($A:$A,A2,$CM:$CM,CM2),"")
You can try this formula which seems to work in my spreadsheet.
Mar 01 2022 09:08 AM
Mar 01 2022 09:36 AM
Your ranges $A$2:$A:$A and $CM$2:$CM:$CM are entire columns of over a million cells each.
I would prefer a Table that resizes to match the data.
= IF(
NOT(COUNTIFS(JobID,[@JobID],Agent,[@Agent],Seq,"<"&[@Seq])),
COUNTIFS(JobID,[@JobID],Agent,[@Agent]),
""
)
Mar 02 2022 05:04 AM
@Peter Bartholomew I tried it but it's giving me a syntax error. I think it's something around the Seq part. I added it like this:
=IF(NOT(COUNTIFS([Job Id (as a string)],[@[Job Id (as a string)]],[Agent name],[@[Agent name]],Seq,"<"&[@Seq])),COUNTIFS([Job Id (as a string)],[@[Job Id (as a string)]],[Agent name],[@[Agent name]]),"")
Mar 02 2022 03:41 PM
My fault I think. I had both structured references and defined names that referred to them. The structured references are more explicit but can make the formulae rather long.
=IF(
NOT(COUNTIFS(
[Job Id (as a string)],[@[Job Id (as a string)]],
[Agent name],[@[Agent name]],
[Seq],"<"&[@Seq])),
COUNTIFS(
[Job Id (as a string)],[@[Job Id (as a string)]],
[Agent name],[@[Agent name]]),
"")
Making [Seq] a structured reference to the helper column should sort it. As an aside, if you had dates in ascending order, they could be used instead of inserting a sequence/serial number.
Mar 09 2022 07:22 AM
Mar 01 2022 07:35 AM
Solution=IF(COUNTIFS($CX$2:CX2,CX2,$CY$2:CY2,CY2)=1,COUNTIFS($CX$2:$CX$11,CX2,$CY$2:$CY$11,CY2),"")
Is this what you are looking for?