COUNTIF matching multiple occurences in a single cell, and adding with numbers in strings.

MAXARN

New Member
Joined
Jul 8, 2011
Messages
26
I have a few questions regarding pattern matching in excel. This is a snippet of a 16x16 cells (some cells are empty):

<table border="0" cellpadding="0" cellspacing="0" width="256"><colgroup><col style="width:48pt" span="4" width="64"> </colgroup><tbody><tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;width:48pt" height="20" width="64">B13N</td> <td class="xl64" style="width:48pt" width="64">B11N</td> <td class="xl63" style="width:48pt" width="64">
</td> <td class="xl64" style="width:48pt" width="64">
</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">B10S</td> <td class="xl64" style="border-top:none">
</td> <td class="xl63" style="border-top:none">
</td> <td class="xl64" style="border-top:none">B09N</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">PU/R04</td> <td class="xl64" style="border-top:none">R07</td> <td class="xl63" style="border-top:none">D1/PY07</td> <td class="xl66" style="border-top:none">R04/TD</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl69" style="height:15.0pt;border-top:none" height="20">
</td> <td class="xl70" style="border-top:none">
</td> <td class="xl71" style="border-top:none">
</td> <td class="xl70" style="border-top:none">
</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl67" style="height:15.0pt;border-top:none" height="20">B07K</td> <td class="xl68" style="border-top:none">B08N/B13K</td> <td class="xl67" style="border-top:none">B08N/B06S</td> <td class="xl68" style="border-top:none">
</td> </tr> </tbody></table>
What I want to count each occurance of a pattern, such as "B??N" and sum that in a cell on the same row it is found. The problem is that when there are multiple matches in one cell COUNTIF() only counts the first match:

=COUNTIF(INDIRECT("AV"&ROW()&":BK"&ROW()),"*B??N*")

If I use (morefunc) MCONCAT to put it all in a string the same problem arise, only worse; I get just one hit per string. I used "/" as a separator in hopes that there would be a function where it would be useful.

Another problem I have is extracting the numbers from some of these patterns and manipulating them.

The only way I've gotten it to work is to copy 16 formulas refering to the 16 different cells one at a time per summary cell (for R??, PY?? and D?) to extract the numbers and add them up. This however works, but is noticibly intensive. I do these 16x fomulas for each of these, per row. At this time there are 16 of these 16x16 arrays they work on, and many more to come.

This is an example of the formula:

=IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("AV"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("AW"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("AX"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("AY"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("AZ"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BA"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BB"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BC"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BD"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BE"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BF"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BG"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BH"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BI"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BJ"&ROW())),"R\d{2}"),2)),0)+IFERROR(VALUE(RIGHT(REGEX.MID(MCONCAT(INDIRECT("BK"&ROW())),"R\d{2}"),2)),0)

These formulas also pose the problem of inserting more colums between the "data" part of the sheet and the summary coulmns.
 
Last edited:

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Here's a screenshot of one of the 16x16 arrays:

Example.png
 
Upvote 0
Hello and welcome to MrExcel

Please refer to the rudimentary sample below. This will count the number cells in that row where the data value matches the pattern:

<center><table align="center" cellpadding="0" cellspacing="0"><tbody><tr><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-top: 0.5pt solid rgb(0, 0, 0); border-left: 0.5pt solid rgb(0, 0, 0);" colspan="7" bgcolor="#0c266b"><table align="center" border="0" width="100%"><tbody><tr><td align="left">Microsoft Excel - Book1</td><td style="font-size: 9pt; color: rgb(255, 255, 255); font-family: caption;" align="right">___Running: xl2000 : OS = Windows XP </td></tr></tbody></table></td></tr><tr><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-left: 0.5pt solid rgb(0, 0, 0); height: 25px;" colspan="7" bgcolor="#d4d0c8"><table valign="MIDDLE" align="center" border="0" width="100%"><tbody><tr><td style="font-size: 10pt; color: rgb(0, 0, 0); font-family: caption;">(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)bout</td><td align="right" valign="center"><form name="formCb755237"><input *******="window.clipboardData.setData("Text",document.formFb078704.sltNb935705.value);" value="Copy Formula" name="btCb873980" type="button"></form></td></tr></tbody></table></td></tr><tr><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-left: 0.5pt solid rgb(0, 0, 0);" colspan="7" bgcolor="white"><table border="0"><tbody><tr><form name="formFb078704"></form><td style="width: 60px;" align="middle" bgcolor="white"><select onchange="document.formFb078704.txbFb426622.value = document.formFb078704.sltNb935705.value" name="sltNb935705"><option value="=COUNTIF($A3:$D3,F$2)" selected="selected">F3</option><option value="=COUNTIF($A4:$D4,F$2)">F4</option><option value="=COUNTIF($A5:$D5,F$2)">F5</option><option value="=COUNTIF($A6:$D6,F$2)">F6</option></select></td><td align="right" bgcolor="#d4d0c8" width="3%">=</td><td align="left" bgcolor="white"><input size="80" value="=COUNTIF($A3:$D3,F$2)" name="txbFb426622"></td></tr></tbody></table></td></tr><tr><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-top: 0.5pt solid rgb(0, 0, 0); border-left: 0.5pt solid rgb(0, 0, 0); background-color: rgb(212, 208, 200);" align="middle" width="2%">
</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; color: black; font-family: menu; background-color: rgb(212, 208, 200);" align="middle"><center>A</center></td><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; color: black; font-family: menu; background-color: rgb(212, 208, 200);" align="middle"><center>B</center></td><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; color: black; font-family: menu; background-color: rgb(212, 208, 200);" align="middle"><center>C</center></td><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; color: black; font-family: menu; background-color: rgb(212, 208, 200);" align="middle"><center>D</center></td><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; color: black; font-family: menu; background-color: rgb(212, 208, 200);" align="middle"><center>E</center></td><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; color: black; font-family: menu; background-color: rgb(212, 208, 200);" align="middle"><center>F</center></td></tr><tr><td style="border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: menu; background-color: rgb(212, 208, 200);" align="middle" width="2%"><center>1</center></td><td style="border-width: 0.5pt; border-style: solid; border-color: rgb(0, 0, 0) rgb(212, 208, 200) rgb(212, 208, 200) rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: left;">Counts</td></tr><tr><td style="border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: menu; background-color: rgb(212, 208, 200);" align="middle" width="2%"><center>2</center></td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(0, 0, 0); font-family: Arial; background-color: rgb(255, 255, 255); text-align: left;">Data</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(0, 0, 0); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(0, 0, 0); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(0, 0, 0); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: left;">B??N</td></tr><tr><td style="border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: menu; background-color: rgb(212, 208, 200);" align="middle" width="2%"><center>3</center></td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: left;">B11N</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: left;">B13N</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">2</td></tr><tr><td style="border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: menu; background-color: rgb(212, 208, 200);" align="middle" width="2%"><center>4</center></td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: left;">B10S</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: left;">B09N</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">1</td></tr><tr><td style="border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: menu; background-color: rgb(212, 208, 200);" align="middle" width="2%"><center>5</center></td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: left;">R07</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">0</td></tr><tr><td style="border-top: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: menu; background-color: rgb(212, 208, 200);" align="middle" width="2%"><center>6</center></td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; border-left: 0.5pt solid rgb(0, 0, 0); color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(0, 0, 0); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(0, 0, 0); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(0, 0, 0); font-family: Arial; background-color: rgb(255, 255, 255); text-align: left;">D1/PY07</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(0, 0, 0); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(212, 208, 200); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">
</td><td style="border-right: 0.5pt solid rgb(0, 0, 0); font-size: 10pt; vertical-align: bottom; color: rgb(0, 0, 0); border-bottom: 0.5pt solid rgb(212, 208, 200); font-family: Arial; background-color: rgb(255, 255, 255); text-align: right;">0</td></tr><tr><td style="border-width: 0.5pt; border-style: solid; border-color: rgb(128, 128, 128) rgb(0, 0, 0) rgb(0, 0, 0); background-color: rgb(212, 208, 200);" colspan="7"><table valign="TOP" align="left" width="100%"><tbody><tr><td style="border-width: 0.5pt; border-style: solid; border-color: rgb(128, 128, 128) rgb(0, 0, 0) rgb(0, 0, 0); width: 120pt; background-color: rgb(255, 255, 255);" align="left">Sheet1</td><td>
</td></tr></tbody></table></td></tr></tbody></table>
[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.</center>
The formula in cell F3 is : =COUNTIF($A3:$D3,F$2) {and coped down}

Apologies for the simple example. This uses a helper column to the side - is this the sort of thing you want? I trust I have understood the problem.....

Once you have extracted the values between the letters, what do you want to do with them? Do you want a total, or a list etc?

Andrew
 
Upvote 0
Right now I can't remember why I used INDIRECT. That formula works if I add wildcards to the helper cell, as any one cell can contain any combination of B??[N-S-C-K-CK], R??, PY??, PA??, CF, DF, D?, CB, and so on (each instance separated with a "/").

However, I don't understand how that formula would solve the problem with COUNTIF() giving up after the first match and thus give me sum=3 if a single cell contains: B10N/B03N/B07N

which is one of the two main problems.
 
Last edited:
Upvote 0
So using the top left cell in your example, it is possible this cell could contain a value such as "B10N/B03N/B07N" which you would counted as 3 - is that correct?

[edit] My apologies. Based on the thread heading I suspect the answer is yes.
 
Last edited:
Upvote 0
Yes, I want such a string to be counted as 3. I have no affinity for COUNTIF(), so if it can be solved by a UDF that would be fine.
 
Upvote 0
Now I remember why I used INDIRECT, I figured it would save me time to put it in a named function.
 
Upvote 0
Yes, I want such a string to be counted as 3. I have no affinity for COUNTIF(), so if it can be solved by a UDF that would be fine.

Hi,

Maybe this UDF

Code:
Function countOccurs(rng As Range) As Long
    Dim RegEx As Object, RegMatches As Object
    Dim aCell As Range, Total As Long
 
    Set RegEx = CreateObject("VBScript.RegExp")
 
    With RegEx
        .MultiLine = False
        .IgnoreCase = True
        .Global = True
        .Pattern = "B\d{2}N"
    End With
 
    For Each aCell In rng
        Set RegMatches = RegEx.Execute(aCell)
        Total = Total + RegMatches.Count
    Next aCell
 
    countOccurs = Total
 
End Function


A B C D E F

<TABLE style="WIDTH: 335pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=446><COLGROUP><COL style="WIDTH: 52pt; mso-width-source: userset; mso-width-alt: 2523" width=69><COL style="WIDTH: 56pt; mso-width-source: userset; mso-width-alt: 2742" width=75><COL style="WIDTH: 83pt; mso-width-source: userset; mso-width-alt: 4022" width=110><COL style="WIDTH: 48pt" span=3 width=64><TBODY><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 52pt; HEIGHT: 15pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=20 width=69>B13N

</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 56pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" id=td_post_2782839 class=xl65 width=75>B11N</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 83pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 width=110>B10N/B03N/B07

</TD>

<TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 width=64> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 width=64> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 width=64 align=right>4</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=20>B10S</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>B09N</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 align=right>1</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=20>PU/R04</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>R07</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>D1/PY07</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>R04/TD</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 align=right>0</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=20> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 align=right>0</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=20>B07K</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>B08N/B13K</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>B08N/B06S</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>

</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" id=td_post_2782800 class=xl65> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 align=right>2</TD></TR></TBODY></TABLE>

Formula in F1
=countOccurs(A1:D1)

HTH

M.
 
Upvote 0
Hi,

Maybe this UDF

Code:
Function countOccurs(rng As Range) As Long
    Dim RegEx As Object, RegMatches As Object
    Dim aCell As Range, Total As Long
 
    Set RegEx = CreateObject("VBScript.RegExp")
 
    With RegEx
        .MultiLine = False
        .IgnoreCase = True
        .Global = True
        .Pattern = "B\d{2}N"
    End With
 
    For Each aCell In rng
        Set RegMatches = RegEx.Execute(aCell)
        Total = Total + RegMatches.Count
    Next aCell
 
    countOccurs = Total
 
End Function
A B C D E F



<table style="WIDTH: 335pt; BORDER-COLLAPSE: collapse" border="0" cellpadding="0" cellspacing="0" width="446"><colgroup><col style="WIDTH: 52pt; mso-width-source: userset; mso-width-alt: 2523" width="69"><col style="WIDTH: 56pt; mso-width-source: userset; mso-width-alt: 2742" width="75"><col style="WIDTH: 83pt; mso-width-source: userset; mso-width-alt: 4022" width="110"><col style="WIDTH: 48pt" span="3" width="64"></colgroup><tbody><tr style="HEIGHT: 15pt" height="20"><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 52pt; HEIGHT: 15pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" height="20" width="69">B13N

</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 56pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" id="td_post_2782839" class="xl65" width="75">B11N</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 83pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" width="110">B10N/B03N/B07

</td> <td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" width="64">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" width="64">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" align="right" width="64">4</td></tr><tr style="HEIGHT: 15pt" height="20"><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" height="20">B10S</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">B09N</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" align="right">1</td></tr><tr style="HEIGHT: 15pt" height="20"><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" height="20">PU/R04</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">R07</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">D1/PY07</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">R04/TD</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" align="right">0</td></tr><tr style="HEIGHT: 15pt" height="20"><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" height="20">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" align="right">0</td></tr><tr style="HEIGHT: 15pt" height="20"><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" height="20">B07K</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">B08N/B13K</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">B08N/B06S</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65">

</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" id="td_post_2782800" class="xl65">
</td><td style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class="xl65" align="right">2</td></tr></tbody></table>

Formula in F1
=countOccurs(A1:D1)

HTH

M.

That works Perfectly, thanks a big bunch Marcelo!

Feel like giving the number-in-string-sum a go as well?
 
Upvote 0
That works Perfectly, thanks a big bunch Marcelo!

Feel like giving the number-in-string-sum a go as well?

You are welcome and tks for the feedback.

To sum try this UDF

Code:
Function sumOccurs(rng As Range) As Double
    Dim RegEx As Object, RegMatches As Object
    Dim aCell As Range, Total As Double, i As Long
 
    Set RegEx = CreateObject("VBScript.RegExp")
 
    With RegEx
        .MultiLine = False
        .IgnoreCase = True
        .Global = True
        .Pattern = "B\d{2}N"
    End With
 
    For Each aCell In rng
        Set RegMatches = RegEx.Execute(aCell)
        For i = 0 To RegMatches.Count - 1
            Total = Total + Val(Mid(RegMatches(i), 2, 2))
        Next i
    Next aCell
 
    sumOccurs = Total
 
End Function

A B C D E F G
<TABLE style="WIDTH: 387pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=515><COLGROUP><COL style="WIDTH: 59pt; mso-width-source: userset; mso-width-alt: 2852" width=78><COL style="WIDTH: 56pt; mso-width-source: userset; mso-width-alt: 2742" width=75><COL style="WIDTH: 80pt; mso-width-source: userset; mso-width-alt: 3876" width=106><COL style="WIDTH: 48pt" span=4 width=64><TBODY><TR style="HEIGHT: 15pt; mso-height-source: userset" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 59pt; HEIGHT: 15pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 height=20 width=78>B13N

</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 56pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" id=td_post_2782839 class=xl63 width=75>B11N</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 80pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 width=106>B10N/B03N/B07</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 width=64> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 width=64> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 width=64 align=right>4</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 width=64 align=right>37</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 height=20> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 align=right>0</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 align=right>0</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 height=20>B10S</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63>B09N</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 align=right>1</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 align=right>9</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 height=20>PU/R04</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63>R07</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63>D1/PY07</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63>R04/TD</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 align=right>0</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 align=right>0</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 height=20> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63>B20N</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 align=right>1</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 align=right>20</TD></TR><TR style="HEIGHT: 15pt; mso-height-source: userset" height=20><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 height=20>B07K</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63>B08N/B13K</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63>B08N/B06S</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" id=td_post_2782800 class=xl63> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl63 align=right>2

</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" id=td_post_2782897 class=xl63 align=right>16</TD></TR></TBODY></TABLE>

Formula in F1 (like my previous post)
=countOccurs(A1:D1)
copy down

Formula in G1
=sumOccurs(A1:D1)
copy down

HTH

M.
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,345
Members
452,907
Latest member
Roland Deschain

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