Search code examples
google-sheetsgoogle-sheets-formulaarray-formulas

ArrayFormula to give Different Serial Numbering for Different Names


Google Sheet Link

I want to have an Arrayformula at A1 to produce this output:

enter image description here

I want to have a different serial numbering for different names. There can be any number of names, names would not be sorted & could repeat any number of time.


Solution

  • You may try:

    =vstack("Header",
            map(B2:B,lambda(Σ,if(Σ="",,countif(B2:Σ,Σ)))))
    

    enter image description here

    Alternate formula:

    =arrayformula(if(len(B2:B),countifs(B2:B,B2:B,row(B2:B),"<="&row(B2:B)),))