How to know the column count of a specific column?

In my script, I gather the table from an excel file and put it into a data table. The data table will be looped and I have a string input where it defines the column where I’ll be basing my condition for the data table. As an example, in the image below, I’ll be setting the string input that defines the column as “L” and a condition where if Diff is > 10,000, the whole row will be store in another data table.

With string input set as “L”, the column count would be 3 since it’s the 4th column in the sample table. Which will make the condition into CurrentRow(3)>10000

How do I achieve this?


Hello @wdescalsota ,

The requirement is a little unclear for me.
Do you want to know the index of the DIFF column inorder to use the if condition?


Yes, by basing on the String input which is “L”

As you already know the column name, can’t you do it like this instead of using index?


The reason why I use the string input is to make the process dynamic, whenever we want to change the column we want to base our condition on. So I prefer to base on excel columns instead of column names that was set.

I think this will do, I’ll try it out

Sequence.xaml (6.6 KB)
Hi Can You try out this @wdescalsota


this is a linq query which gives you result of rows >10000 to different datatable

Thank you for providing me the sample xaml file for it. This will be good reference for me. I’ll check this one out as well.

1 Like

I now recall why I didn’t refer to the column names, the design of the process doesn’t gather the column names

While you are reading the excel, check the AddHeaders checkbox to get the column names as well. Without column names I don’t think you will be able to check that condition.



I think if there is a change of column positions in future, it will be always preferable to go with the Column Name. It will be more accurate and you can use the Column name to filter the values instead of the column index.

Hi @wdescalsota ,

We would also Prefer you to Convert the Value to it’s Comparing Type, Like above we have the value 1000, which is a numeric.

We would need to Convert the CurrentRow("DIFF") column value to an Integer or Double and then Compare :

CDbl(CurrentRow("DIFF").ToString) > 1000