Count all rows with values in one column in Excel

Hello :slight_smile:

I’m having problems with a simple thing: I want to count all rows that contains values in just one specific column in my excel spreadsheet.

To understand better, imagine that my table is the example above.

| Column1 | Column2 |
| zzz     | example |
| yyy     | example |
| xxx     |         |

If the robot counts all the rows with values in “Column1”, it will be 3.
If the robot counts all the rows with values in “Column2”, it will be 2

Can someone help me?

1 Like

Hey @req7,

You can try to loop through each column that needs to be counted and check the value of the cell. If there is a value then you can increment a counter. This approach may not be the most efficient but it should be very easy to implement.

Zev

Main.xaml (8.8 KB)

Hope this help.

2 Likes

use following code in assign acitivity
datatablename.defaultview.ToTable(false,“Column2”).Rows.count

@req7

find a quick prototype doing it dynamicly for all Columns and generates a statistic datatble with column Name and Count. Find starter Help here:
Statistic_NotEmptyRowsCount_ByCol_AllCols.xaml (8.2 KB)

The Prototype was done with LINQ but for sure we can decompose it into more essential Activities if this is required

1 Like

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