This is a built-in feature for the Member Directory shortcode. This quick tutorial will show you how to display members in your members list who have a specific custom field key/value.
To show members who have specific custom field simply enter the custom field key in shortcode as option and give it the value you want to return or retrieve members with that value only. Here are few examples to help you.
Example 1: Display members who have “Gender” custom field as “Male”
[userpro template=memberlist gender="Male"]
Example 2: Display members who have “City” custom field as “New York”
[userpro template=memberlist city="New York"]