How to count empty rows in excel

I have 1 excel having some column names A B C D
I need the count of empty rows
(condition : column A must have data and D is empty then count no of empty rows of D column)
Can anyone help me here…

Hi I used filter data table activity but this not working in this case

can anyone help me here

Loop through it

Set counter = 0

if row(“D”)is null or empty using a series of if statement for each condition.
If each cell is empty, then add 1 to counter
Then write it
Happy Automation

better to tell, what exactly is not working

Maybe the data has some spaces and would require a trim before checking


Assign activity:
myCount | int32 =

(From d in YourDataTableVar.AsEnumerable
Where Not ( isNothing(d("ColA")) OrElse String.IsNullOrEmpty(d("ColA").toString.Trim) )
Where isNothing(d("ColD")) OrElse String.IsNullOrEmpty(d("ColD").toString.Trim)
Select r=d).Count

Hi @ppr ,
thank you, but I got below error could you please suggest me here
thanks in advance

we do feel that your statement differs from ours.
->(From…) ← .Count

Just recheck and correct

Hi @panguluri_saritha

You can achieve this by using the following steps:

  1. Read the Excel file into a DataTable using the Read Range activity.
  2. Initialize a variable to keep count of the empty rows. Let’s call it emptyRowCount and set it to 0.
  3. Iterate through each row in the DataTable.
  4. For each row, check if Column A is not empty and Column D is empty. If both conditions are met, increment emptyRowCount by 1.
  5. After processing all rows, emptyRowCount will contain the count of empty rows where Column A has data, and Column D is empty.


1 Like

thank you so much @ppr

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