Dynamic Numbering

lawi227

Board Regular
Joined
Mar 17, 2016
Messages
123
I have a list of to-do's and want to number them based on grouping. I would think this would be a fairly easy formula to build but my knowledge of Excel is limited.


Below is an example of WHAT I WOULD LIKE (row 1 is the column this data can be found in; row 2 is the name of the column; row 3 begins sample data):
Column BColumn G
"#""To-Do"
01.01.101.01 Clean House
01.01.201.01 Clean House
01.02.101.02 Wash Carpet
01.02.201.02 Wash Carpet
01.02.301.02 Wash Carpet
02.01.102.01 Clean Car
02.02.102.02 Mow Lawn
02.02.202.02 Mow Lawn

<tbody>
</tbody>

Note: I may add a to-do to the bottom of the list; e.g., 01.01 may end up in row 50 while all the other "01.01 to-dos" are in rows 3:4. Therefore the formula cannot just check to see if the cell in column G above is the same.

I built the first part of the formula which is to extract the first 5 characters from the ### column G: =left(G2,5). I would then like to add the unique number after those 5 characters extracted (as shown above in the table).

I need help building the rest of the formula.

Thanks so much!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
In B2:
=LEFT(G2,FIND(" ",G2&" ")-1)&"."&COUNTIF($G$2:G2,LEFT(G2,FIND(" ",G2&" ")-1)&"*")

Copy down.


Excel 2010
BCDEFG
201.01.101.01 Clean House
301.01.201.01 Clean House
401.02.101.02 Wash Carpet
501.02.201.02 Wash Carpet
601.02.301.02 Wash Carpet
702.01.102.01 Clean Car
802.02.102.02 Mow Lawn
902.02.202.02 Mow Lawn
1001.01.301.01 Clean House
Sheet1
Cell Formulas
RangeFormula
B2=LEFT(G2,FIND(" ",G2&" ")-1)&"."&COUNTIF($G$2:G2,LEFT(G2,FIND(" ",G2&" ")-1)&"*")
 
Last edited:
Upvote 0
In B2:
=LEFT(G2,FIND(" ",G2&" ")-1)&"."&COUNTIF($G$2:G2,LEFT(G2,FIND(" ",G2&" ")-1)&"*")

Copy down.

Excel 2010
BCDEFG
201.01.101.01 Clean House
301.01.201.01 Clean House
401.02.101.02 Wash Carpet
501.02.201.02 Wash Carpet
601.02.301.02 Wash Carpet
702.01.102.01 Clean Car
802.02.102.02 Mow Lawn
902.02.202.02 Mow Lawn
1001.01.301.01 Clean House

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

Worksheet Formulas
CellFormula
B2=LEFT(G2,FIND(" ",G2&" ")-1)&"."&COUNTIF($G$2:G2,LEFT(G2,FIND(" ",G2&" ")-1)&"*")

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

<tbody>
</tbody>

This worked perfect! Thanks so much. Can you explain briefly how it works? I am unfamiliar with the FIND function.
 
Upvote 0
Sure.

We need to isolate the number part by itself. So FIND looks for the first space and returns the position of it. We subtract 1 because we don't actually want the space.
So, in this line:
01.01 Clean House

The Space is at position 6. We subtract 1 and then take this many characters with LEFT leaving 01.01. Then we want to do a COUNTIF to get a count of everything that starts with that at that point in the list which is why it is an absolute reference in the first part of the range in the COUNTIF but the second part of the range is allowed to increase by row. So it only gives you the count up to that point, which is why you're numbers will increase the further it goes down the list.

Hope this helps
 
Upvote 0
Thanks so much!

Can I ask for a slight modification if it's easy....

The numbering you created after the "01.01" doesn't begin with a zero. Is there anyway to adjust the formula so it displays "01.01.01" instead of "01.01.1"?
 
Upvote 0
It didn't start with a zero because you didn't show that in your original sample.

Here you go:
=LEFT(G2,FIND(" ",G2&" ")-1)&TEXT(COUNTIF($G$2:G2,LEFT(G2,FIND(" ",G2&" ")-1)&"*"),"\.00")
Copy down.
 
Upvote 0
Hi Scott,

I am trying to modify the above formula. Whenever there is a blank in column G, can the formula just number those blanks 1, 2, 3, 4, etc. - no need to add the ".00". This numbering would ideally be a continuation so that all blanks (Regardless of row), will be numbered.
 
Upvote 0
=if(g2="",countif($g$2:g2,""),left(g2,find(" ",g2&" ")-1)&text(countif($g$2:g2,left(g2,find(" ",g2&" ")-1)&"*"),"\.00"))
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

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