Near by Group between two different features

Discussion created by kgeronimo on Jun 5, 2014

I found this model on the ESRI blog:

This model finds the closest feature that has the same attributes as an input feature, within the same layer.

I would like to know if this model can be altered to find distances between points with the same attributes in two different layers, not just within the same layer.  So, using the table below as an example, even if the point 1_input in the input feature layer is actually closer to the point 2_near in the near feature layer, the calculation would skip it and find the distance to the 1_near instead, since it shares the same Attribute X value.

Input Feature layer
Point ID Attribute X value
1_input A
2_input A
3_input B
4_input A
5_input B

Near Feature layer
Point ID Attribute X value
1_near A
2_near B

Any suggestions would be much appreciated