Need to Fetch data from excel where previous row value is blank in Excel

Need to Fetch data where the previous row value is blank in Excel
Like in the above example I have to fetch
1200,51.50 ( Row 17) and 1206,5.00 ( Row 23) and 1265,1.00 ( Row 25) and 4500,8.00 ( Row 27) and 4502,20.50 ( Row 31)
Employee.xlsx (10.1 KB)

Any expert help, please?

Hi @c3f1e68294fdcf4a1f0a817ca

Try this:

list_Values1 = (From row In dt.AsEnumerable().Skip(1)
                Where String.IsNullOrEmpty(row(0).ToString()) AndAlso
                      String.IsNullOrEmpty(row(1).ToString()) AndAlso
                      String.IsNullOrEmpty(row(2).ToString()) AndAlso
                      String.IsNullOrEmpty(row(3).ToString()) AndAlso
                      String.IsNullOrEmpty(row(4).ToString()) AndAlso
                      Not String.IsNullOrEmpty(row(5).ToString()) AndAlso
                      Not String.IsNullOrEmpty(row(6).ToString())
                Select String.Format("{0},{1}", row(5).ToString(), row(6).ToString())).ToList()

The output datatype is list.

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