2) column B contains numbers

No it doesn't

---

4) counted occurrences in column D

How are we supposed to count the numbers in column A that are equal to the letters in column B?

---

5) Result should show digits of column A corresponding to only unique values of column c ..

We wont necessarily reach this point unless you can explain points 2 and 4.

---

To save everyones time, here is sample Google Sheet that we can continue development of the solution:

https://docs.google.com/spreadsheets...gid=2100307022

Please provide more clear explanation regarding points 2 and 4, and we can take it from there.