Today’s challenge was to create a scrollable index for a list of companies that groups them by the first letter of the company name. It took a bit of figuring out, but I am very happy with the result and want to share so it can help someone else. I had searched but was not able to find the answer in the forum.
So here is a quick loom:
And here the formula that made it work:
={“Index”; ARRAYFORMULA(IFNA(REGEXEXTRACT(A2:A, “.”)))}
Just a comment on your choice of function for the arrayformula. Whilst REGEXEXTRACT() obviously does the job, it’s probably a bit of overkill for this use case. There are lots of ways you can extract the first character from a string, but probably the simplest would be by using LEFT()
Note that while LEFT() accepts a parameter indicating how many characters to extract, it is optional and defaults to 1. Which it makes it perfect for your use case