Write cell activity with IF condition

Hi,

I have a automation which requires to add retrieved information to Excel.
At the moment it writes correctly in each row the information needed in the desired column.

Now i have a IF activity that has a condition to read if the information is available inside a column.
If it already exist it changes one column in the already available row.

I might have the condition wrong with IF: row(16).ToString.Contains(NAME).
It keeps on adding the same information, it creates duplicated instead of skipping and changing the specific column.

It’s difficult to share the workflow because it’s filled with company information.

Any help is appreciated!

Hey,
take a look this workflow. I hope it will be helpful for you :slight_smile:
ifExcelCommunity.zip (22.8 KB)

1 Like

@sirwa

You condition should be like

row(16).ToString.Contains(“NAME”)

You can proceed with declaring then and else as per your requirement

Hope this will help you

Thanks

1 Like

Thanks for the quick response!

I use the condition: row(16).ToString.Contains(NAME), because name is a variable.

i feel like my condition is not being read at all, it just jumps to the else part.
if i give it multiple information which are identical. It will not see the name variable for some reason.

I might have the whole setup up wrong with read range?
it’s an Excel that needs to be read first, to add the information with the IF condition. The Excel is made out of a pivot table.

@sirwa

Can you make a breakpoint after Read Range and check the Datatable result in Locals pane, also you can put a breakpoint at IF condition to check what the Name variable contains and what row(16).toString contains

That will help you understanding the issue

Thanks

1 Like

Hi,

I think your IF condition is wrong. if you are not sure about your column name use the expression like below. it will work fine. thanks.

row(YourDatatable.Columns(16)).ToString.Contains(NAME)

1 Like

Thanks for the help!

I tried to specify the read range to only read the columns where my variable ‘name’ can have a match. Now the following problem might be the reason for the if condition not working properly?

The read range will only read up to 900 cells. But the whole column contains equal to 3500 cells.
What could possible cause Uipath not reading all the values? There are a few cells that are empty.

I wrote into the Range: “R1:R7000” (it stops around 900 values).

Anyone?

I think that you have to share as example of your workflow.
It’s hard without it say something more.

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