I have 2 columns of data in excel sheet.

I am comparing the first row of first column with all the rows of second column with this code

How can I do the same with all the rows of first column???

int m = 1; int p = 1; for (int n = 1; n < 86; n++) { if ((xlWorkSheet.Cells[p, 1].Value.ToString()).Equals((xlWorkSheet.Cells[n, 2].Value.ToString()))) { xlWorkSheet.Cells[m, 4] = xlWorkSheet.Cells[n, 2]; m++; } }

Thanks

John