Count singles,double,tripple

bilbon

Board Regular
Joined
Dec 19, 2011
Messages
83
Hi,

I have a row that looks like this.

<TABLE style="WIDTH: 143pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=182><COLGROUP><COL style="WIDTH: 11pt; mso-width-source: userset; mso-width-alt: 512" span=13 width=14><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 11pt; HEIGHT: 12.75pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66 height=17 width=14>R</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66 width=14>R</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 1.5pt solid" class=xl67 width=14>R</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl68 width=14> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66 width=14> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 1.5pt solid" class=xl67 width=14> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl68 width=14>R</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66 width=14> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 1.5pt solid" class=xl67 width=14> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl69 width=14>R</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66 width=14> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66 width=14>R</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 11pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66 width=14>R</TD></TR></TBODY></TABLE>

I want to calculate the following:

Max empty cells in row Right answer is 3

Max 'R' in series Right answer is 3

Number of "R" if they are singles Right answer is 2

Number of "R" if they come as a double Right answer is 1

Number of "R" if they come as triple Right answer is 1

Is there a helpful person who can help me with these 5 formulas?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi,

I learn't how to do this from a post by Excel MVP Domenic here:
http://www.ozgrid.com/forum/showthread.php?t=71645&p=369653#post369653

All the following are Array formulae and need to be entered with Ctrl>Shift>Enter not just Enter:

  • Max empty cells:
    =MAX(FREQUENCY(IF(A1:M1="",COLUMN(A1:M1)),IF(A1:M1<>"",COLUMN(A1:M1))))
  • Max 'R' in series:
    =MAX(FREQUENCY(IF(A1:M1="R",COLUMN(A1:M1)),IF(A1:M1<>"R",COLUMN(A1:M1))))
  • Number of "R" if they are singles:
    =SUM(--(FREQUENCY(IF(A1:M1="R",COLUMN(A1:M1)),IF(A1:M1<>"R",COLUMN(A1:M1)))=1))
  • Number of "R" if they come as a double:
    =SUM(--(FREQUENCY(IF(A1:M1="R",COLUMN(A1:M1)),IF(A1:M1<>"R",COLUMN(A1:M1)))=2))
  • Number of "R" if they come as triple:
    =SUM(--(FREQUENCY(IF(A1:M1="R",COLUMN(A1:M1)),IF(A1:M1<>"R",COLUMN(A1:M1)))=3))
 
Upvote 0
The spaces is the tough part. Maybe someone can figure that one out for you. Singles, doubles, and triples I have here:

<b>Excel 2003</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th><th>H</th><th>I</th><th>J</th><th>K</th><th>L</th><th>M</th><th>N</th><th>O</th><th>P</th><th>Q</th><th>R</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">Value 1</td><td style=";">Value 2</td><td style=";">Value 3</td><td style=";">Value 4</td><td style=";">Value 5</td><td style=";">Value 6</td><td style=";">Value 7</td><td style=";">Value 8</td><td style=";">Value 9</td><td style=";">Value 10</td><td style=";">Value 11</td><td style=";">Value 12</td><td style=";">Helper</td><td style=";">Total Spaces</td><td style=";">Max Spaces</td><td style=";">Singles</td><td style=";">Doubles</td><td style=";">Triples</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";"> RR     R   </td><td style="text-align: right;;">9</td><td style="text-align: right;;"></td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td><td style="text-align: right;;">0</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";">RR RRR RRR  </td><td style="text-align: right;;">4</td><td style="text-align: right;;"></td><td style="text-align: right;;">0</td><td style="text-align: right;;">1</td><td style="text-align: right;;">2</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"> RRRRR   R  </td><td style="text-align: right;;">6</td><td style="text-align: right;;"></td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";"> RRR R    RR</td><td style="text-align: right;;">6</td><td style="text-align: right;;"></td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"> RR R RR R R</td><td style="text-align: right;;">5</td><td style="text-align: right;;"></td><td style="text-align: right;;">3</td><td style="text-align: right;;">2</td><td style="text-align: right;;">0</td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">RRR  R   RR </td><td style="text-align: right;;">6</td><td style="text-align: right;;"></td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">   R RRRR RR</td><td style="text-align: right;;">5</td><td style="text-align: right;;"></td><td style="text-align: right;;">2</td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">  R R RR RR </td><td style="text-align: right;;">6</td><td style="text-align: right;;"></td><td style="text-align: right;;">2</td><td style="text-align: right;;">2</td><td style="text-align: right;;">0</td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";">RRR R R  R  </td><td style="text-align: right;;">6</td><td style="text-align: right;;"></td><td style="text-align: right;;">3</td><td style="text-align: right;;">0</td><td style="text-align: right;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">RRR   R R RR</td><td style="text-align: right;;">5</td><td style="text-align: right;;"></td><td style="text-align: right;;">2</td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"> RRRRRR    R</td><td style="text-align: right;;">5</td><td style="text-align: right;;"></td><td style="text-align: right;;">1</td><td style="text-align: right;;">0</td><td style="text-align: right;;">2</td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";">   R R     R</td><td style="text-align: right;;">9</td><td style="text-align: right;;"></td><td style="text-align: right;;">3</td><td style="text-align: right;;">0</td><td style="text-align: right;;">0</td></tr><tr ><td style="color: #161120;text-align: center;">14</td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R  R R R R R</td><td style="text-align: right;;">6</td><td style="text-align: right;;"></td><td style="text-align: right;;">6</td><td style="text-align: right;;">0</td><td style="text-align: right;;">0</td></tr><tr ><td style="color: #161120;text-align: center;">15</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";">    RR R RRR</td><td style="text-align: right;;">6</td><td style="text-align: right;;"></td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">16</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";">R</td><td style=";">RR RRR RRRRR</td><td style="text-align: right;;">2</td><td style="text-align: right;;"></td><td style="text-align: right;;">0</td><td style="text-align: right;;">2</td><td style="text-align: right;;">2</td></tr><tr ><td style="color: #161120;text-align: center;">17</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";">R R   RR  R </td><td style="text-align: right;;">7</td><td style="text-align: right;;"></td><td style="text-align: right;;">3</td><td style="text-align: right;;">1</td><td style="text-align: right;;">0</td></tr><tr ><td style="color: #161120;text-align: center;">18</td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";">R</td><td style=";">R</td><td style=";"></td><td style=";">R</td><td style=";"></td><td style=";"></td><td style=";"></td><td style=";">  R  RR R   </td><td style="text-align: right;;">8</td><td style="text-align: right;;"></td><td style="text-align: right;;">2</td><td style="text-align: right;;">1</td><td style="text-align: right;;">0</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">M2</th><td style="text-align:left">=IF(<font color="Blue">A2=""," ","R"</font>)&IF(<font color="Blue">B2=""," ","R"</font>)&IF(<font color="Blue">C2=""," ","R"</font>)&IF(<font color="Blue">D2=""," ","R"</font>)&IF(<font color="Blue">E2=""," ","R"</font>)&IF(<font color="Blue">F2=""," ","R"</font>)&IF(<font color="Blue">G2=""," ","R"</font>)&IF(<font color="Blue">H2=""," ","R"</font>)&IF(<font color="Blue">I2=""," ","R"</font>)&IF(<font color="Blue">J2=""," ","R"</font>)&IF(<font color="Blue">K2=""," ","R"</font>)&IF(<font color="Blue">L2=""," ","R"</font>)</td></tr><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">N2</th><td style="text-align:left">=LEN(<font color="Blue">M2</font>)-LEN(<font color="Blue">SUBSTITUTE(<font color="Red">M2," ",""</font>)</font>)</td></tr><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">P2</th><td style="text-align:left">=(<font color="Blue">LEN(<font color="Red">SUBSTITUTE(<font color="Green">SUBSTITUTE(<font color="Purple">M2,"RRR",""</font>),"RR",""</font>)</font>)-LEN(<font color="Red">SUBSTITUTE(<font color="Green">SUBSTITUTE(<font color="Purple">SUBSTITUTE(<font color="Teal">M2,"RRR",""</font>),"RR",""</font>),"R",""</font>)</font>)</font>)</td></tr><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">Q2</th><td style="text-align:left">=(<font color="Blue">LEN(<font color="Red">SUBSTITUTE(<font color="Green">M2,"RRR",""</font>)</font>)-LEN(<font color="Red">SUBSTITUTE(<font color="Green">SUBSTITUTE(<font color="Purple">M2,"RRR",""</font>),"RR",""</font>)</font>)</font>)/2</td></tr><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">R2</th><td style="text-align:left">=(<font color="Blue">LEN(<font color="Red">M2</font>)-LEN(<font color="Red">SUBSTITUTE(<font color="Green">M2,"RRR",""</font>)</font>)</font>)/3</td></tr></tbody></table></td></tr></table><br />
 
Upvote 0
Hi Guys,

Thank you all very much for your help.It solved all my problems directly and I learned a lot.


/bilbon
 
Upvote 0

Forum statistics

Threads
1,223,604
Messages
6,173,320
Members
452,510
Latest member
RCan29

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