This is quick Excel macro project based on the attached test data.
For each provider number, select 25 competitor provider numbers based on this selection criteria:
1. Within same geozip
2. Highest number of cases
3. Broaden search until all spots filled by stepping geozip +/- 1
4. For example, if target provider number 400022 (row 22 of test data), it is in Geozip 007. There are 18 records in Geozip 007, so the macro would select 17 records from Geozip 007 (not including the target). Then, it would scan Geozips 008 (+1) and Geozips 006 (-1) for 8 additional records to fill the competitor columns. Because number of cases is additional search criteria, the macro would select 6 records from 006: 400114, 400021, 400103, 400014, 400118, 400115. It would select 2 records from 008: 480002 and 480001
5. Now, the macro will sort the 25 records by name (Column D) alphabetically and place the first name (closest to letter A) in column E... last name closest to letter Z in column AC.
6. Macro will be written so new data can be copied in columns A-D and then re-run.