Excel - For each row

Hi I have a problem,
from below image,
image

I should search for current month (MAY), in next row I should get first occurence of value, in my case 16 and i want corresponding date i.e 8…

Next I want to search in next month (JUN)row where I want date 6 corresponding to value 16…

Like this I want to loop through all the columns from 2nd row and get corresponding date from 1st and 3rd row…

please help me on this

@MEGHA_cs

First use find/replace activity and find the month cell…for eg search for Jun Which gives the output as the cell number

use the cell number and read data starting from that cell…this way you would be interested in only first two riws always which have the corresponding months data

Now use for each with dt.Columns,change type argument to datacolumn and inside that use if condition with dt.Row(1)(currentitem.ColumnName).ToString.Equals("16") you can sue variable in place of 16 on then side use dt.Row(0)(currentitem.ColumnName).ToString will give the required number you need

cheers

Thanks… but am not clear yet… you mean I dont need to use for each row in dt in the beginning

@MEGHA_cs

If you read whole data then you need to and then filter all all…

rather if you search for the month cell then the data is read only from that row…so you dont need for each at first as those would by default be the first two rows

cheers

Thank you…

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.