Help with Countifs

Schubby10

New Member
Joined
Aug 16, 2018
Messages
33
Hye guys looking for some help with countifs

In column A I am looking to create a formula to concatenate the dept and the various metrics.

The countifs should count each job code that begins with 1- that falls in this category.

Dept are in B and Unique Identifier for job code in E.

I currently have a formula IFERROR(CONCATENATE(COUNTIFS(E$1:E4,LEFT(E4,2)="1-",B$1:B4,B4),"-",B4),"")
But it only returns 0's any idea why?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Some sample data would be helpful.

I don't think LEFT(E4,2)="1-" will produce a result.

Try a helper column with the LEFT, then countif that column is 1-
 
Last edited:
Upvote 0
[TABLE="width: 320"]
<colgroup><col width="64" span="5" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Code[/TD]
[TD="width: 64"]Dept[/TD]
[TD="width: 64"]Dept Code[/TD]
[TD="width: 64"]Dept Head[/TD]
[TD="width: 64"]Job Code[/TD]
[/TR]
[TR]
[TD]1-AR[/TD]
[TD]AR[/TD]
[TD][/TD]
[TD]Bob[/TD]
[TD]1-123[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]AR[/TD]
[TD][/TD]
[TD]Bob[/TD]
[TD]2-123[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]AR[/TD]
[TD][/TD]
[TD]Bob[/TD]
[TD]3-123[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]AR[/TD]
[TD][/TD]
[TD]Bob[/TD]
[TD]4-123[/TD]
[/TR]
[TR]
[TD]2-AR[/TD]
[TD]AR[/TD]
[TD][/TD]
[TD]Bob[/TD]
[TD]1-677[/TD]
[/TR]
[TR]
[TD]3-AR[/TD]
[TD]AR[/TD]
[TD][/TD]
[TD]Bob[/TD]
[TD]1-789[/TD]
[/TR]
[TR]
[TD]4-AR[/TD]
[TD]AR[/TD]
[TD][/TD]
[TD]Bob[/TD]
[TD]1-801[/TD]
[/TR]
[TR]
[TD]1-Retail[/TD]
[TD]Retail[/TD]
[TD][/TD]
[TD]Joe[/TD]
[TD]1-875[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]REtail[/TD]
[TD][/TD]
[TD]Joe[/TD]
[TD]2-875[/TD]
[/TR]
[TR]
[TD]2-Retail[/TD]
[TD]Retial[/TD]
[TD][/TD]
[TD]Joe[/TD]
[TD]1-982[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Retail[/TD]
[TD][/TD]
[TD]Joe[/TD]
[TD]2-982[/TD]
[/TR]
[TR]
[TD]1-Online[/TD]
[TD]Online[/TD]
[TD][/TD]
[TD]Amy[/TD]
[TD]1-654[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Online[/TD]
[TD][/TD]
[TD]Amy[/TD]
[TD]2-654[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
F2 - =LEFT(E2,2)
G2 - =COUNTIFS(F$1:F2,"1-",B$1:B2,B2)

[TABLE="width: 448"]
<colgroup><col width="64" span="7" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"]Code[/TD]
[TD="class: xl65, width: 64"]Dept[/TD]
[TD="class: xl65, width: 64"]Dept Code[/TD]
[TD="class: xl65, width: 64"]Dept Head[/TD]
[TD="class: xl65, width: 64"]Job Code[/TD]
[TD="class: xl65, width: 64"]left[/TD]
[TD="class: xl65, width: 64"]result[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"]1-AR[/TD]
[TD="class: xl65, width: 64"]AR[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Bob[/TD]
[TD="class: xl65, width: 64"]1-123[/TD]
[TD="class: xl65, width: 64"]1-[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]AR[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Bob[/TD]
[TD="class: xl65, width: 64"]2-123[/TD]
[TD="class: xl65, width: 64"]2-[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]AR[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Bob[/TD]
[TD="class: xl65, width: 64"]3-123[/TD]
[TD="class: xl65, width: 64"]3-[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]AR[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Bob[/TD]
[TD="class: xl65, width: 64"]4-123[/TD]
[TD="class: xl65, width: 64"]4-[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"]2-AR[/TD]
[TD="class: xl65, width: 64"]AR[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Bob[/TD]
[TD="class: xl65, width: 64"]1-677[/TD]
[TD="class: xl65, width: 64"]1-[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"]3-AR[/TD]
[TD="class: xl65, width: 64"]AR[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Bob[/TD]
[TD="class: xl65, width: 64"]1-789[/TD]
[TD="class: xl65, width: 64"]1-[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"]4-AR[/TD]
[TD="class: xl65, width: 64"]AR[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Bob[/TD]
[TD="class: xl65, width: 64"]1-801[/TD]
[TD="class: xl65, width: 64"]1-[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"]1-Retail[/TD]
[TD="class: xl65, width: 64"]Retail[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Joe[/TD]
[TD="class: xl65, width: 64"]1-875[/TD]
[TD="class: xl65, width: 64"]1-[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]REtail[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Joe[/TD]
[TD="class: xl65, width: 64"]2-875[/TD]
[TD="class: xl65, width: 64"]2-[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"]2-Retail[/TD]
[TD="class: xl65, width: 64"]Retial[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Joe[/TD]
[TD="class: xl65, width: 64"]1-982[/TD]
[TD="class: xl65, width: 64"]1-[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Retail[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Joe[/TD]
[TD="class: xl65, width: 64"]2-982[/TD]
[TD="class: xl65, width: 64"]2-[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"]1-Online[/TD]
[TD="class: xl65, width: 64"]Online[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Amy[/TD]
[TD="class: xl65, width: 64"]1-654[/TD]
[TD="class: xl65, width: 64"]1-[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Online[/TD]
[TD="class: xl65, width: 64"] [/TD]
[TD="class: xl65, width: 64"]Amy[/TD]
[TD="class: xl65, width: 64"]2-654[/TD]
[TD="class: xl65, width: 64"]2-[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Was having another look, and thought i'd add this for your future benefit.

The reason E$1:E4,LEFT(E4,2)="1-" was failing is because LEFT(E4,2)="1-" or = = will return a TRUE or FALSE depending if there's a match or not. So you were searching E$1:E4 for TRUE or FALSE.
 
Upvote 0
Hi,

Perhaps this is what you're after, formula in A2 copied down:


Book1
ABCDE
1CodeDeptDept CodeDept HeadJob Code
21-ARARBob1-123
3ARBob2-123
4ARBob3-123
5ARBob4-123
62-ARARBob1-677
73-ARARBob1-789
84-ARARBob1-801
91-RetailRetailJoe1-875
10RetailJoe2-875
112-RetailRetailJoe1-982
12RetailJoe2-982
131-OnlineOnlineAmy1-654
14OnlineAmy2-654
Sheet383
Cell Formulas
RangeFormula
A2=IF(LEFT(E2,2)="1-",COUNTIFS(B$2:B2,B2,E$2:E2,"1-*")&"-"&B2,"")
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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