CountIFS with Unique String

Simon2001

New Member
Joined
Jun 28, 2019
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hi

I'm trying to use a COUNTIFS on some data with multiple criteria. My source sheet has a list and each row has a different single or multiple code in the type column. On a separate sheet, I'm using the COUNTIFS to count and search the range for how many contain each unique code but I am stumped and its only counting the unique codes (single entry per cell) but I also want it to count them within in a cell with multiple code entries.

For example below, code 21-HR is counted twice but I want it to return 4 times as its also in two cells which have multiple values.

In the attached sheet, 21-HR is in rows 27 & 29 but also within rows 14 & 15.

The formula used is simply =COUNTIFS($B$4:$B$34,$C4) and for ease of review, I've left out the other criteria in the COUNTIFS.

Can anyone help?
 

Attachments

  • Countifs.PNG
    Countifs.PNG
    33.9 KB · Views: 29
U can try this.
With your posted sample data, try changing B1 to 1-HR

@Simon2001
For earlier version try this. Note that the formula should be confirmed with Ctrl+Shift+Enter, not just Enter

23 02 10.xlsm
BCD
1
2
3Risk CodesCodeCount
422-HR1-HR0
532-HR, 22-HR2-HR1
622-HR, 12-HR3-HR0
712-HR4-HR0
82-HR5-HR0
96-HR0
107-HR0
118-HR0
129-HR0
1310-HR0
1411-HR0
1512-HR2
1613-HR0
1714-HR0
1815-HR0
1916-HR0
2017-HR0
2118-HR0
2219-HR0
2320-HR0
2421-HR0
2522-HR3
2623-HR0
2724-HR0
2825-HR0
2926-HR0
3027-HR0
3128-HR0
3229-HR0
3330-HR0
3431-HR0
3532-HR1
3633-HR0
3734-HR0
Count HR
Cell Formulas
RangeFormula
D4:D37D4=COUNT(SEARCH(" "&C4&","," "&$B$4:$B$100&","))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You're welcome. Hopefully one or more of the suggestions will work for you. :)
 
Upvote 0

Forum statistics

Threads
1,223,718
Messages
6,174,082
Members
452,542
Latest member
Bricklin

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