the overall code without duplication

What dose it's mean?

No duplication in each ID (single row)
or
No duplication in ALL ID (by remove 0 away) but still problem it's not refer to each field (column)


It will be better if you can upload a sample file with sample desired output.

Regards.