# Fill Series Number With Criteria

##### Well-known Member
helllo...

i am looking formula to fill series number based on adjacent with basic count of data 3 cell like this :
<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<tr><td>1</td><td>a</td></tr>
<tr><td>1</td><td>a</td></tr>
<tr><td>1</td><td>a</td></tr>
<tr><td>2</td><td>a</td></tr>
<tr><td>2</td><td>a</td></tr>
<tr><td>2</td><td>a</td></tr>
<tr><td>3</td><td>a</td></tr>
<tr><td>4</td><td>e</td></tr>
<tr><td>5</td><td>f</td></tr>
<tr><td>5</td><td>f</td></tr>
<tr><td> </td><td>etc..</td></tr>
</tbody></table>

.sst

#### mrshl9898

##### Well-known Member
I had these in columns A and B.

In C2 =IF(B2=B1,0,1)+IF((COUNTIF(B\$2:B2,B2)-1)/3=0,0,IF(ROUNDDOWN((COUNTIF(B\$2:B2,B2)-1)/3,0)=(COUNTIF(B\$2:B2,B2)-1)/3,1,0))
In D2 =SUM(C\$2:C2)

##### Well-known Member
thanks,..my data in b2 down [given]...and my desired result in A2 down...

#### Rick Rothstein

##### MrExcel MVP
thanks,..my data in b2 down [given]...and my desired result in A2 down...
Put a 1 in cell A2, then put this formula in cell A3 and copy it down...

=IF(OR(B3<>B2,MOD(COUNTIF(B\$2:B3,B3),3)=1),A2+1,A2)

##### Well-known Member
sorry ricks...i missing it..

working well..thank you

Last edited:

#### Rick Rothstein

##### MrExcel MVP
hey ricks...not working...put a or 1 in cell A2?
Describe "not working"... what happens that shouldn't happen?

Yes, A1 will always be 1, so put it there (the formula needs a number in the preceding cell in order to work)... then put the formula in A3 and copy it down.