I want to check if the value in both datasets is equal. But the datasets are not in the same order so need to loop through the datasets.
Dataset 1 contract : enter image description here
Part number | H50 | H51 | H53 |
---|---|---|---|
ID001 | 1 | 1 | 1 |
ID002 | 1 | 1 | 1 |
ID003 | 0 | 1 | 0 |
ID004 | 1 | 1 | 1 |
ID005 | 1 | 1 | 1 |
data 2 anx : enter image description here
So the partnumber are not in the same order, but to check the value the partnumber needs to be equal from each file. Then if the part nr is the same, check if the Hcolumn is the same too. If both partnumber and the H(header)nr are the same, check if the value is the same.
Part number | H50 | H51 | H53 |
---|---|---|---|
ID001 | 1 | 1 | 1 |
ID003 | 0 | 0 | 1 |
ID004 | 0 | 1 | 1 |
ID002 | 1 | 0 | 1 |
ID005 | 1 | 1 | 1 |
Expecting outcome:
If the value 1==1 or 0 == 0 from both dataset -> change to TRUE. If the value = 1 in dataset1 but = 0 in dataset2 -> change the value to FALSE. and safe all the rows that contains FALSE value into an excel file name "Not in contract" If the value = 0 in dataset1 but 1 in dataset2 -> change the value to FALSE
Example expected outcome
Part number | H50 | H51 | H53 |
---|---|---|---|
ID001 | TRUE | TRUE | TRUE |
ID002 | TRUE | FALSE | TRUE |
ID003 | TRUE | FALSE | FALSE |
ID004 | FALSE | TRUE | TRUE |
ID005 | TRUE | TRUE | TRUE |