Search code examples
arraysregexgoogle-sheetssequencearray-formulas

Creating A Concatenated ID w/ Leading Zeroes Using Sequence in Google Sheets


Table

I am very close here but due to my still novice understanding of Regular Expressions, I am not getting exactly the results I want.

In B1 sits a variable used to create a sequence.

The desired output is

Team01,Team02,Team03,Team04,Team05,Team06,Team07,Team08,Team09,Team10,Team11,Team12

The data in that table is generated by this formula in B3

=ARRAYFORMULA({"TeamID";"Team"&SEQUENCE(SUBSTITUTE(B1,"\\10\\2","^[1-9]\d*(?:\.\d{1,2})?$"))})

I know that the formula isn't working because the RegEx isn't correct and maybe i need to be using other tools, but I'm still new to this and trying to piece together what needs to change.


Solution

  • try:

    =ARRAYFORMULA(TEXT(SEQUENCE(B1), "\T\e\a\m0#"))
    

    or shorter:

    =INDEX(TEXT(SEQUENCE(B1), "\T\e\a\m0#"))
    

    enter image description here