jeudi 5 novembre 2015

Check if value in A is unique to B in VBA

I have a tab that i run multiple checks on in VBA using an IF statement. I want to add something that checks this, but i cant seem to figure out an easy way to do so:

     A           B
   1 Yellow     Banana
   2 Yellow     Banana
   3 Blue       Banana
   4 Red        Tomato
   5 Orange     Tomato
   6 Green      Pear
   7 Green      Pepper

My file looks like the example above.

For instance: i have to check to see if every fruit in B that is Banana, then the colour in A is Yellow.

Banana can also have another color/or a second one (purple for instance) but then purple cant be used for other fruits in B anymore.

These colors are just exampled, and it has nothing do do with fruit and colors. But just to make it easier to understand.

TLDR:

Once a color/value from A has been linked to a certain fruit/value in B. Then that color/value in A cannot be used for another fruit/value anymore.

Is there an easy way to do this in VBA in my current IF statement?

Aucun commentaire:

Enregistrer un commentaire