1. The formula should be entered ONLY in the first row. No copying down.
2. Delete and try again.
3. If you STILL get #NAME, your version of O365 may not support SCAN.
4. Check the versuin by looking at the account page.
5. Alternatively, use:
=C2&LET(a,D3:D500,B,FILTER(a,F3:F500>0),c,SEQUENCE(ROWS(B)),LOOKUP(c,c/(B>""),B))
ONLY in c3.
Bookmarks