aiPreview
Open in TheBrain

grok

troubleshoot why this formula spills in Excel but the next one does not; the second one starts to spill after 20 rows with nothing blocking it in the rows above it. optimize both when done with analysis.

=LET(comparelookup,
   LET(
     matchedstring,XLOOKUP(J109,allquestions[number],allquestions[more2],"number not found",0),
     compareleft,LEFT(matchedstring,20),
     IF(compareleft="is incorrect because",MID(matchedstring,22,LEN(matchedstring)-21),matchedstring)
   ),
   IF(comparelookup=K109,"dupe",comparelookup)
)

=LET(comparelookup,
   LET(
     matchedstring,XLOOKUP(J109,allquestions[number],allquestions[more3],"number not found",0),
     compareleft,LEFT(matchedstring,20),
     IF(compareleft="is incorrect because",MID(matchedstring,22,LEN(matchedstring)-21),matchedstring)
   ),
   IF(OR(comparelookup=K3:k109,comparelookup=L3:l109),"dupe",comparelookup)
)