Forum Discussion
How to assign unique value for each group of duplicates?
- Nov 28, 2022
=INDEX($B$2:B2,MATCH(A2,$A$2:A2,0))
You can enter this formula in cell C2 and copy down.
Then you can select range A1:B9 and apply a custom sort. In the example i checked "My table has headers" (in german: Daten haben Überschriften) and selected "largest to smallest" (in german: Nach Größe (absteigend) ). Then i clicked ok.
The result is that INDEX and MATCH adds all numbers in column C "unified number".
OliverScheurich Thank you, it's working in this example. INDEX and MATCH is finding first value and assigning it to the rest of duplicates. But if the first value is empty it will assign null. See below, I've removed first value from Belgium. How to make it match first non empty value?
ountry | Number | Unified Number |
Belgium | 0 | |
Belgium | 0 | |
Belgium | 54 | 0 |
Belgium | 0 | |
Belgium | 0 | |
Belgium | 54 | 0 |
Great Britan | 57 | 57 |
Great Britan | 57 | 57 |
=INDEX($B$2:B2,MATCH(A2,$A$2:A2,0))
You can enter this formula in cell C2 and copy down.
Then you can select range A1:B9 and apply a custom sort. In the example i checked "My table has headers" (in german: Daten haben Überschriften) and selected "largest to smallest" (in german: Nach Größe (absteigend) ). Then i clicked ok.
The result is that INDEX and MATCH adds all numbers in column C "unified number".