I am trying to create a formula which tests two sets of variables and can repeat the process until it finds the sets that meets the requirements. I have it set up as and if statement right now but the nesting limitations will not allow the process to be repeat the number of times necessary. (approximately 1500 iterations)

=IF(SQRT((B2-'1 ft station data'!B$3)^2+('Existing Field Data'!C2-'1 ft station data'!C$3)^2)-SQRT((B2-'1 ft station data'!B$2)^2+('Existing Field Data'!C2-'1 ft station data'!C$2)^2)=1,'1 ft station data'!E$2,0)

When the next if statement is inserted into the false response the formula is repeated and '1 ft station data'!B$3 is changed to '1 ft station data'!B$4 and all other variables from from that data sheet are referencing the next lower cell in the same fashion.

Is there a better way to go about this? Any help would be greatly appreciated. Thanks