Please help me in writing the formula. Because of match first occurence it is getting repeated.
I have "From", "To" NODE IDs of road segments which are not in order and needs to be reordered. I found the two unique values which are first node and last node of the corridor and started with one.
D2=E2
E3 =IF(INDEX($B$3:$C$33,IFERROR(MATCH($D3,$B$3:$B$33,0),MATCH($D3,$C$3:$C$33,0)),1)=D3,INDEX($B$3:$C$33,IFERROR(MATCH($D3,$B$3:$B$33,0),MATCH($D3,$C$3:C33,0)),2),INDEX($B$3:$C$33,IFERROR(MATCH($D3,$B$3:$B$33,0),MATCH($D3,$C$3:$C$33,0)),1))
[TABLE="width: 428"]
<tbody>[TR]
[TD]SlNo[/TD]
[TD]From[/TD]
[TD]To[/TD]
[TD]Reorder From[/TD]
[TD]Reorder To[/TD]
[TD]Row Occurrence[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]100028[/TD]
[TD="align: right"]329136[/TD]
[TD="align: right"]100028[/TD]
[TD="align: right"]329136[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]100192[/TD]
[TD="align: right"]329149[/TD]
[TD="align: right"]329136[/TD]
[TD="align: right"]100196[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]100192[/TD]
[TD="align: right"]329182[/TD]
[TD="align: right"]100196[/TD]
[TD="align: right"]329027[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]100193[/TD]
[TD="align: right"]100558[/TD]
[TD="align: right"]329027[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]27[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]100193[/TD]
[TD="align: right"]329147[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD="align: right"]100194[/TD]
[TD="align: right"]100425[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD="align: right"]100194[/TD]
[TD="align: right"]329189[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD="align: right"]100195[/TD]
[TD="align: right"]329059[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD="align: right"]100195[/TD]
[TD="align: right"]329139[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD="align: right"]100196[/TD]
[TD="align: right"]329027[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="align: right"]100196[/TD]
[TD="align: right"]329136[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="align: right"]100425[/TD]
[TD="align: right"]329144[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="align: right"]100558[/TD]
[TD="align: right"]100646[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD="align: right"]100618[/TD]
[TD="align: right"]100619[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD="align: right"]100618[/TD]
[TD="align: right"]100656[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD="align: right"]100619[/TD]
[TD="align: right"]100620[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD="align: right"]100620[/TD]
[TD="align: right"]100621[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]18[/TD]
[TD="align: right"]100621[/TD]
[TD="align: right"]325013[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]19[/TD]
[TD="align: right"]100646[/TD]
[TD="align: right"]329189[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]20[/TD]
[TD="align: right"]100654[/TD]
[TD="align: right"]325012[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]21[/TD]
[TD="align: right"]100654[/TD]
[TD="align: right"]329185[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]22[/TD]
[TD="align: right"]100655[/TD]
[TD="align: right"]100656[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]23[/TD]
[TD="align: right"]100655[/TD]
[TD="align: right"]329186[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]24[/TD]
[TD="align: right"]320001[/TD]
[TD="align: right"]325013[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]25[/TD]
[TD="align: right"]325012[/TD]
[TD="align: right"]329186[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]26[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]27[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329139[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]28[/TD]
[TD="align: right"]329027[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]29[/TD]
[TD="align: right"]329059[/TD]
[TD="align: right"]329143[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]30[/TD]
[TD="align: right"]329143[/TD]
[TD="align: right"]329144[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]31[/TD]
[TD="align: right"]329147[/TD]
[TD="align: right"]329149[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]32[/TD]
[TD="align: right"]329182[/TD]
[TD="align: right"]329185[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
</tbody>[/TABLE]
Thank you very much in advance.
I have "From", "To" NODE IDs of road segments which are not in order and needs to be reordered. I found the two unique values which are first node and last node of the corridor and started with one.
D2=E2
E3 =IF(INDEX($B$3:$C$33,IFERROR(MATCH($D3,$B$3:$B$33,0),MATCH($D3,$C$3:$C$33,0)),1)=D3,INDEX($B$3:$C$33,IFERROR(MATCH($D3,$B$3:$B$33,0),MATCH($D3,$C$3:C33,0)),2),INDEX($B$3:$C$33,IFERROR(MATCH($D3,$B$3:$B$33,0),MATCH($D3,$C$3:$C$33,0)),1))
[TABLE="width: 428"]
<tbody>[TR]
[TD]SlNo[/TD]
[TD]From[/TD]
[TD]To[/TD]
[TD]Reorder From[/TD]
[TD]Reorder To[/TD]
[TD]Row Occurrence[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]100028[/TD]
[TD="align: right"]329136[/TD]
[TD="align: right"]100028[/TD]
[TD="align: right"]329136[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]100192[/TD]
[TD="align: right"]329149[/TD]
[TD="align: right"]329136[/TD]
[TD="align: right"]100196[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]100192[/TD]
[TD="align: right"]329182[/TD]
[TD="align: right"]100196[/TD]
[TD="align: right"]329027[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]100193[/TD]
[TD="align: right"]100558[/TD]
[TD="align: right"]329027[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]27[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]100193[/TD]
[TD="align: right"]329147[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD="align: right"]100194[/TD]
[TD="align: right"]100425[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD="align: right"]100194[/TD]
[TD="align: right"]329189[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD="align: right"]100195[/TD]
[TD="align: right"]329059[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD="align: right"]100195[/TD]
[TD="align: right"]329139[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD="align: right"]100196[/TD]
[TD="align: right"]329027[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="align: right"]100196[/TD]
[TD="align: right"]329136[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="align: right"]100425[/TD]
[TD="align: right"]329144[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="align: right"]100558[/TD]
[TD="align: right"]100646[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD="align: right"]100618[/TD]
[TD="align: right"]100619[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD="align: right"]100618[/TD]
[TD="align: right"]100656[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD="align: right"]100619[/TD]
[TD="align: right"]100620[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD="align: right"]100620[/TD]
[TD="align: right"]100621[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]18[/TD]
[TD="align: right"]100621[/TD]
[TD="align: right"]325013[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]19[/TD]
[TD="align: right"]100646[/TD]
[TD="align: right"]329189[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]20[/TD]
[TD="align: right"]100654[/TD]
[TD="align: right"]325012[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]21[/TD]
[TD="align: right"]100654[/TD]
[TD="align: right"]329185[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]22[/TD]
[TD="align: right"]100655[/TD]
[TD="align: right"]100656[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]23[/TD]
[TD="align: right"]100655[/TD]
[TD="align: right"]329186[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]24[/TD]
[TD="align: right"]320001[/TD]
[TD="align: right"]325013[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]25[/TD]
[TD="align: right"]325012[/TD]
[TD="align: right"]329186[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]26[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]27[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329139[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]28[/TD]
[TD="align: right"]329027[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]29[/TD]
[TD="align: right"]329059[/TD]
[TD="align: right"]329143[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]30[/TD]
[TD="align: right"]329143[/TD]
[TD="align: right"]329144[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]31[/TD]
[TD="align: right"]329147[/TD]
[TD="align: right"]329149[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]32[/TD]
[TD="align: right"]329182[/TD]
[TD="align: right"]329185[/TD]
[TD="align: right"]328011[/TD]
[TD="align: right"]329137[/TD]
[TD="align: right"]25[/TD]
[/TR]
</tbody>[/TABLE]
Thank you very much in advance.
Last edited: