Ooops posted my code higher up.(i.e. completed code that appears to work)
Update: Copied the code below so more easily found
Just to confirm - it will accept any number of files and any selection of fields and calculate the minimum amount of records required from across all the files to demonstrate the full range of field values for the fields selected. (I think!).
If anyone can pick up on any bugs please let me know :-)