I have 2 excel sheets and in those two excel sheet i’ll be matching column1 of 1st sheet with column2 of anoter sheet and when the match happens I want to get that Count of the row at which the match happens.
You mean you want the row index where the match has happened, if yes then you want row index from first sheet or from the second
or the number of times the match happens?
Also please provide excel sheets.
I would suggest selecting and counting values in the second column.
The line to extract a count for a particular row item would look like that:
See the workflow for extra reference:
SelectingValueCount.zip (7.6 KB)
I overdid the solution
For the index of the row where the match happens, you can take the 0 result of your selection and use IndexOf to get the index.
Ican’t provide excel…but i want the Count of 5th row from first row…
If you mean to get the current row index, please see the attached workflow:
SelectingRowIndexValue.zip (7.8 KB)
Let us take you are having excel sheet 1 in dta and excel sheet 2 in dtb
Now create a List of strings List A , which will contain the Index of row of excel sheet 1 which got matched with column 2 of excel sheet 2
List A = (From p In dta.Select where (From q In dtb.Select where p("Column1_ Name").ToString.Equals(q("Column2_Name").ToString) Select q).Count>0 Select Convert.ToString(dta.Rows.IndexOf(p))).ToList
Now List A will contain the Index of rows of Sheet 1 whose column 1 matched with column 2 of Excel Sheet2
And Also if you want top know the count of rows which got matched then you can take ListA.Count
actually my need is getting the Count of fifth row data from first row…i.e what is position Count of fifth row from first row where first row is a header
If you use Read Range Activity And check the Add Headers Property, then the first row will become headers. DataTable_Variable.Rows(4) will give you 5th row since the index of DataRow Array is 0.
For better understanding please post some excel Screen shots with your Requirement.