I am trying to implement a formula that will auto number rows within a group
** OPEN Google Sheets URL **
https://docs.google.com/spreadsheets/d/1Uhy1jLTiozXq1M2S3b0ACjqxv3-pCMC2Rr4BhkuBzfU/edit?usp=sharing
The way I have it now, works but if I add a row in a subgroup it doesnt work:
=ArrayFormula({"1";COLUMNS($B$1:B$1) & "." & ROW($B$1:indirect("A"&counta(A13:A25)))})
and for Phase 2 I have to do this:
=ArrayFormula({"2";COLUMNS($A$1:B$1) & "." & ROW($B$1:indirect("A"&counta(A27:A33)))})
And besides that I have a feeling that the first part ;COLUMNS($B$1:B$1) decide what number is in front of the x.1 So if I use B$1:B$1 it will use 2, but if I do ;COLUMNS($E$1:E$1) it will use 5. I don't think this should be the way.
There are some more notes in the document if anyone is interested
Is there anyone who knows how to fix this numbering?
Well, here's a reusable formula that doesn't depend on you figuring out the row number or doing any tedious editing:
Depending on your locale, you may have to use
,instead of;as argument separators.Caveats:
|in them.Here's a more readable version:
Explanation:
|'s. The end of the string is a bunch of|s.Phase 1|Task 1|...|...Phase 2. If it's the last phase, we extractPhase N|...||instead, then substitute||with|. This is why it only works on a Phase row.|s to determine number of tasks. Do this by removing all non-|'s from the string and getting the length..0with empty for phase row.