0

I have 2 sheets, sheet4 contains a range of dates, in this case 20 of them, sheet1 contains 7 of these dates from sheet4 after I filtered out the duplicates. I need to compare these two arrays and get the row number of the matching values on sheet1.

Sheet1 values:

sheet1

Sheet4 values:

enter image description here

I need to check which row number on sheet1 is corresponding to the value on sheet4. For example, "F1" on sheet4 would give me the value of 2 (as of row 2), and "F5" "F6" and "F7" which are all 07/11/2019 06:10 would all give me the value of 3. I need the corresponding row numbers in an array as well, so I can use them later on next to the sheet4 dates.

I can't seem to figure it out how to write the code for it, as the arrays are different length.

Edit: My code so far. It returns the row numbers of sheet one multiple times, in an order, like: 1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7

var sheet4Array = ' array on sheet 4 column F';
var sheet1Values = 'values on sheet 1 in an array';
var rowMM = ' row numbers on sheet 1';


var sheet1Array = []; // sheet 1 array
var ss1Arr = [];
for (var p = 0; p < sheet4Array.length; p++) {
   for (var s = 0; s < sheet1Values.length; s++) {
      if (sheet4Array[p].indexOf(sheet1Values[s])) {
      var sheet1A = rowMM[s];
       sheet1Array .push(sheet1A);
      }
   } 
} 

0 Answers0