The attached is a bit of a guess.
1. You use SMALL which when met with cells that contain errors (eg. rows 218,799,1972 and 10 more in the
ATC sheet) always returns an error. I have changed this for the equivalent AGGREGATE function adding the option to ignore errors.
2. I suspect you have your x/y coordinate references back to front. I have swapped (eg. in row 7) all instances of B7 for C7 and
vice versa. This is only a guess and I haven't examined closely if the formula is still logically correct. You should check this for yourself and the results.
The file was too big to attach so here's a link instead:
Excel workbook
Edit: I was too late to see that you updated your attached workbook but I see that you've swapped the x/y columns on one sheet. You also changed the SMALL to MIN but this still throws an error (even if you use the MIN equivalent AGGREGATE function) so I tried the AGGREGATE equivalent of SMALL (AGGREGATE(15,6…)) which seemed to work but gave different results - so do check!