ChatGPT wrote multiple versions of this function, all of which work correctly (copy/paste and run). The revisions based on my input were also flawless. Turned to chat after wasting 10 minutes writing this manually. Mine didn't use IndexFunc, a great idea by chat. Impressive!