For Each Activity does not recognize variables

Hi All: I am trying to build a robot that find each row with specific title,

Below is the excel sheet I am working on,
I found a robot that is able to return the value for column “status”

But what about I want to use the specific date instead of the “status”?
For example the tile of the column is “8/1/2020” in stead of the “status”
And because I only want to read the value for current date, so I assign a variable“M/01/yyyy”)
But for the “If” activity, after I change the “status” to the variable_currentdate as below, then it never recognize(never return me the value),

Could you please teach me how to let this robot to give value when the title of the column changed from “status” to a variable, currentdate?


It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly

Hey @YAMATOUSA :wave:

Did you try formatting the current date to a particular format? Say, the date in your Excel file is 8/1/2020, you have to format the current date to suit that column name so, try this:

If col.ToString = DateTime.Now.ToString("MM/dd/yyyy"){
rowValue = row(col).ToString

Let me know if you are facing any issues! Cheers!

The problem is in the “col.ToString” expression in the IF condition.
It will return a string formated according your default locale settings.
In my case it is “08/01/2020 00:00:00” - which indeed doesn’t match your “currentdate” variable.

I would recommend to change “currentdate” assign like follows:

It will give you format compatible with “col.ToStrimg”


1 Like

thank you!

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