Have two sets of user inputs. Need to check if any sequential *pairs* of input are replicated between the two sets, how can I do this?

tectactoe

New Member
Joined
Dec 1, 2021
Messages
1
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I will try to condense this into a general sense. I have an Excel sheet with two different sets of cells that require user input. The first sets has 8 inputs, the second set has 5.

Let's say the Data Sets One and Two have user inputs of letters, like so:

VBA Code:
DataSetOne(0) = A
DataSetOne(1) = B
DataSetOne(2) = C
DataSetOne(3) = D
DataSetOne(4) = E
DataSetOne(5) = F
DataSetOne(6) = G
DataSetOne(7) = H

DataSetTwo(0) = A
DataSetTwo(1) = B
DataSetTwo(2) = H
DataSetTwo(3) = D
DataSetTwo(4) = C

I need to check the two sets for replicated data. However, I only care if any two side-by-side values are repeated, not just single values.

For example, Data Set One contains seven sequential "pairs" of input data:

Code:
Pair 1 = A, B
Pair 2 = B, C
Pair 3 = C, D
Pair 4 = D, E
Pair 5 = E, F
Pair 6 = F, G
Pair 7 = G, H

And similarly, Data Set Two have four additional pairs of data:

Code:
Pair 8 = A, B
Pair 9 = B, H
Pair 10 = H, D
Pair 12 = D, C

I need to see if any of these pairs match. Order does not matter - as long as two pairs have the same two individual inputs, I need to make a decision one way. If the pairs do not contain both matching values , then my decision goes a different way.

So in the above example, I need my code to recognize matches between:

  • Pair 1 and Pair 8
  • Pair 3 and Pair 12
Based on this, my code would do one thing. Meanwhile all of the other pairs, since they do not contain two matching/identical values, would do a different thing. I feel like this should be relatively simple yet I can't figure out how to do it. Any help appreciated. Thank you.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I
I will try to condense this into a general sense. I have an Excel sheet with two different sets of cells that require user input. The first sets has 8 inputs, the second set has 5.

Let's say the Data Sets One and Two have user inputs of letters, like so:

VBA Code:
DataSetOne(0) = A
DataSetOne(1) = B
DataSetOne(2) = C
DataSetOne(3) = D
DataSetOne(4) = E
DataSetOne(5) = F
DataSetOne(6) = G
DataSetOne(7) = H

DataSetTwo(0) = A
DataSetTwo(1) = B
DataSetTwo(2) = H
DataSetTwo(3) = D
DataSetTwo(4) = C

I need to check the two sets for replicated data. However, I only care if any two side-by-side values are repeated, not just single values.

For example, Data Set One contains seven sequential "pairs" of input data:

Code:
Pair 1 = A, B
Pair 2 = B, C
Pair 3 = C, D
Pair 4 = D, E
Pair 5 = E, F
Pair 6 = F, G
Pair 7 = G, H

And similarly, Data Set Two have four additional pairs of data:

Code:
Pair 8 = A, B
Pair 9 = B, H
Pair 10 = H, D
Pair 12 = D, C

I need to see if any of these pairs match. Order does not matter - as long as two pairs have the same two individual inputs, I need to make a decision one way. If the pairs do not contain both matching values , then my decision goes a different way.

So in the above example, I need my code to recognize matches between:

  • Pair 1 and Pair 8
  • Pair 3 and Pair 12
Based on this, my code would do one thing. Meanwhile all of the other pairs, since they do not contain two matching/identical values, would do a different thing. I feel like this should be relatively simple yet I can't figure out how to do it. Any help appreciated. Thank you.
Initial questions:
1) Are you looking for a VBA or formula solution?
2) Are the pair already generated or do you need to generate it?
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,521
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top