Fomula to Match Items in a List

Justinian

Well-known Member
Joined
Aug 9, 2009
Messages
1,557
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet and in column G are codes like IP (in progress) or SS (short-staffed), among others. These codes are a saved range called "Codes" and they are in column AH. AH is a dynamic range so that is why there is no cell reference here. I want to use a COUNTIF formula to count all codes from AH that appear in column G but do not know how to construct the formula with MATCH or INDEX.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Why would you want to use INDEX/MATCH to count something (I/M will only ever return the 1st match it finds, then stop looking)? If you are only counting based on 1 criteria, COUNTIF should work. If you have more than 1 criteria, use countifS()
 
Upvote 0
Thus the reason for my question as COUNTIF is not working.
 
Upvote 0
OK so what's the problem?
is countif() not working for you?
If not, what is it returning, compared to what you expected?
Show some sample data please?
 
Upvote 0
It would help if you could show us what your input looks like, and what you want for output. The best I could gather from your initial request is something like this:

GHAGAHAIAJAK
1CodesCodesCountTotalTotal
2IPIP41212
3SSSS1
4XYXY4
5IPAB2
6IPCD1
7XYEF0
8ABGH0
9IPIJ0
10AB0
11XY
12CD
13XY
14

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3

Worksheet Formulas
CellFormula
AI2=COUNTIF(G:G,AH2)
AJ2=SUM(AI:AI)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
AK2{=SUM(COUNTIF(G:G,AH2:AH20))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



Codes in G, possible duplicates. List of possible values in AH. Then the COUNTIF to count specific codes could be placed in AI2, and copied down. Then if you want the total of all values, you could just SUM column AI, which is the formula in AJ2. If you want the sum of the values without using column AI, then the array formula in AK2 will work. If you have the code range (AH2:AH20 in this example) defined as a dynamic range, just use that name in the formula instead.
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,936
Members
449,094
Latest member
teemeren

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