# Automatic numbering in the unsequence's row for grouping

#### Onnyhendra

##### New Member

 description automatic numbering w1 1 w1 1 w2 1 w3 1 w1 2 w3 1 w2 1 w3 2 w3 2 w3 3 w2 2 w2 2 w3 3 w1 2

<colgroup><col><col></colgroup><tbody>
</tbody>

For the support and attention
Thank You...

<colgroup><col><col></colgroup><tbody>
</tbody>

### Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

#### AOB

##### Well-known Member
You're more likely to get a reply if you provide a logic or pattern to what you're looking for?

There is no discernible pattern to the sample you've provided?

What determines whether the "automatic numbering" should be 1, 2, 3, x...

#### Onnyhendra

##### New Member
Dear AOB, Thanks for the suggestion,

I don't how to explain more, basically as below:

 Desire No. description automatic numbering 1 w1 1 2 w1 1 3 w2 1 4 w3 1 5 w1 2 6 w3 1 7 w2 1 8 w3 2 9 w3 2 10 w3 3 11 w2 2 12 w2 2 13 w3 3 14 w1 2 Quantity w1=4 in every 2 times will be automatic number (start in 1) w2=4 in every 2 times will be automatic number (start in 1) w3=6 in every 2 times will be automatic number (start in 1)

<colgroup><col><col><col><col span="2"></colgroup><tbody>
</tbody>

Thank you so much.

#### njimack

##### Well-known Member
B1: =1
B2: (confirm with ctrl+shift+enter,then copy down as far as necessary) =MAX(IF(A\$1:A1=A2,B\$1:B1))+IF(MOD(COUNTIF(A\$1:A1,A2),2)=0,1,0)

#### AOB

##### Well-known Member
So if I get this right, you want the "automatic number" to effectively be a count of the description, but only to increment (1>2, 2>3 etc.) on every second instance of that description?

Assuming "description" is in column A and "automatic number" is in column B, and the first row of data is in row 2

This formula in cell B2 :

Code:
``=ROUNDUP(COUNTIF(\$A\$2:\$A2,\$A2)/2,0)``

...dragged to the end of the data should produce he desired result

(Note the anchoring - enter the formula precisely as above or it won't work)

#### Rick Rothstein

##### MrExcel MVP
 Quantity w1=4 in every 2 times will be automatic number (start in 1) w2=4 in every 2 times will be automatic number (start in 1) w3=6 in every 2 times will be automatic number (start in 1)

<tbody>
</tbody>
You had left the above out of your original post (it tells us the logic behind your numbers).

Now, if I understand your requirement correctly, this normally entered formula should work for you...

=ROUNDDOWN(COUNTIF(A\$1:A1,A1)/2,0)+(MOD(COUNTIF(A\$1:A1,A1),2)=1)

#### Onnyhendra

##### New Member
Great Sir,

Thanks so much for AOB, Neil and Mr. Rick.
It's working perfect for the last.

Regards,

Replies
3
Views
402
Replies
4
Views
2K
Replies
0
Views
130
Replies
2
Views
235
Replies
4
Views
473

1,195,659
Messages
6,010,957
Members
441,578
Latest member
brodiej

### 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.

### Which adblocker are you using?

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

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