Get row count of matched two excel

hi,
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.
please help…
@SaranyaKishore @Manjuts90

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. :slight_smile:

@somya177

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:
dataTable.Select(""+dataTable.Columns(1).ColumnName+"='"+dataTable.Rows(0).Item("firstColumn").ToString+"'").count

See the workflow for extra reference:
SelectingValueCount.zip (7.6 KB)

EDIT
I overdid the solution :smiley:
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…

i want the Count of fifth row from first row in excel…where first row is a header…
@Manjuts90 can u help
@SaranyaKishore

If you mean to get the current row index, please see the attached workflow:
SelectingRowIndexValue.zip (7.8 KB)

@somya177

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

Regards
Mahesh

hii,

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

@somya177

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.

Regards,
Mahesh

Hii,

Below is the excel…n help me how can i get count of each row from headers i.e. first row…