Countif or Countifs or some other extraction formula?

linacherfas

New Member
Joined
Jan 26, 2022
Messages
2
Office Version
  1. 2016
Platform
  1. MacOS
Hi everyone,

I'm trying to pull data from one column in a table into another tab so that I can create a visualization for a dynamic dashboard. The column includes state and city abbreviations, sometimes several jurisdictions in the same cell separated by commas, and many instances of "N/A". See the screenshot of the pivot table that summarizes what's in the column. I'm trying to extract the data so that I have a count of each individual jurisdiction (state or city, doesn't matter) separately, without the commas as in the pivot table.

When I tried doing COUNTIF formulas for each jurisdiction abbreviation separately, it doesn't capture the ones in the lists - for example, it returns 0 for HI because HI only appears as part of "LA, HI, PA". When I tried COUNTIFS for "HI" and "HI," it returned 0. Not sure why. Then I tried this version with wildcards: =COUNTIF(Table1[[#All],[Non-Consultant P2P Jurisdiction]],"*"&"HI"&"*") but it incorrectly returns 2 for Hawaii, because it counts HI and also the PHI (which is Philadelphia). I've tried several versions of the wildcard formula, leaving out the wildcard on one or the other side of the jurisdiction name, but I end up with incorrect counts for some jurisdictions however I do it.

I also tried combining COUNTIF with ISNUMBER and SEARCH, but that got me no results.

Please help?!! Huge thank you in advance!

Best wishes,
-lina



pivot screen shot.png
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi,

Are you looking for something like this:

Book3.xlsx
ABCD
1Count ofResult
2N/AN/A1
3NYCNYC3
4CACA2
5DEDE1
6RIRI1
7SC, UT, WA, TNSC1
8BCUT1
9MDWA2
10TXTN1
11TBDBC1
12LA, HI, PAMD1
13IATX2
14AZTBD1
15NYC, AZLA1
16AZ, PAHI2
17PHIPA2
18WA, PHI, CAIA1
19PHI, HIAZ3
20TX, NYCPHI3
Sheet974
Cell Formulas
RangeFormula
D2:D20D2=SUMPRODUCT(--(ISNUMBER(SEARCH(" "&C2&","," "&A$2:A$20&","))))
 
Upvote 0

Forum statistics

Threads
1,214,639
Messages
6,120,679
Members
448,977
Latest member
dbonilla0331

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