Hello, I have excel with two columns: one is a city, the seconde one is a name of river. I need to find a intersection and get an unique value for each group. Each group is created from the same river and particular cities. If city has two rivers, this should be in the same group. But also the second river and respective city should have the same value as the first river. ... and again. If there is a city with another river. This should be same number as the first and second river. For the second group with unique number in third column (e.g.2), the same rules apply...the same river=same number. Same city = same number. One city has two river. The second river has the same number but also cities where the second river is...and so on. Here is and example. I have more then 10 000 values. Any idea how to do it? Many thanks.