I have created two data validations in columns A and B (Sheet2) by taking the unique values from columns A and B in Sheet1.

The problem is that when you choose a value in column A, then you can choose ALL values from column B. I want the displayed
values in the validation list in B to contain only the matching combinations, not all the values. That way you can't add an invalid
combination of A and B. In sheet 1 all the possible, valid combinations are listed and in sheet 2 you add rows.

I found the following to be very popular:

=INDEX($B$2:$B$8, SMALL(IF($A$11=$A$2:$A$8, ROW($A$2:$A$8)-ROW($A$2)+1), ROW(1:1)))
It can create the list I want, by changing 1:1 to 2:2, 3:3 etc. but you use x cells (as many as the combinations). How can I
incorporate this in the validation list? That is, to put the above as a formula in the list.

Is there another way to look into?