Finding last record from excel data match and write cell

Hi all,
I have one output sheet so basically I want to find last row from it then in if condition I need to check column wise data check if two colum data match then write it in next column match .so I created flow like:
Read range-dtoutput
For each row
Row(“column1”).tostring=row(“column2”). tostring if field matches
In then part
Write cell
“Match” and “N”+counter.tostring and in else part “notmatch”
Outside it
Counter+1
But the problem is it is checking from first row till last . basically I want directly last row column check if match then write match in n column. do u guys have any solution for this

Read all your excel data into data table and use data table variable and following syntax in assign activity to get last row of your table.

  • YourDatatableVar.AsEnumeration.Last()
    or
  • YourDatatableVar.Rows(YourDatatableVar.Rows.Count-1)


Suppose this is excel nd now row2 and row3 data is already filled.now wt I want directly take row4 check chq no match if match then put match in D4 or not match in D4

Hi @sayali_rokade,

You can read the data as datatable and in for each loop before your if condition you can add another if condition like

if(String.IsNullOrEmpty(row(“Column3”).Tostring))
in the then section you can add your another if logic where it will check for the match of both columns.

Regards,
Rajeswari

1 Like

Showing data row can’t convert to data table

Hi @sayali_rokade ,

Maybe you could try changing the Flows to the Below :

1. Read range-dtoutput
2. For each row
          if String.IsNullOrWhitespace(row("N Column Data").ToString.Trim)
          then
              If Row("column1").tostring=row("column2"). tostring
              then
                      Write cell "Match" and "N"+counter.tostring
              else 
                      Write Cell "notmatch"
           else
                 //Leave Empty
      Counter+1

Check if the above method works and let us know if you face any errors.

1 Like

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