IF and ASSIGN activity (to compare excel values)

Hi, I am trying to compare two values across different sheets in excel and to automate sending of email if one value is smaller than the other.
For example,
I have a number in cell A1 in sheet 1 and another number in cell B2 in sheet 2.
I’m looking for UiPath to help me automate sending an email if cell A1 in sheet 1 is smaller than cell B2 in sheet 2. Should I use read range first and assign value followed by flow decision or if function?
I have the ‘Send Outlook Mail Message’ done but I’m stuck at the front part of condition step.

Can I confirm if the assign step is required? And should i save the variable type as data table before assigning it?
Since it is only a cell value instead of a data table, I’m trying to figure out how should the assign step be filled up. Thanks!

Hi @victorialim

Could it be repeated process or its just for a one cell?

Because you have mentioned single cell range in both sheets

Regards

Just a single cell thanks!
To compare one cell from sheet 1 against another cell in sheet 2.
If cell 1 is greater than cell 2, then an email will be sent.

Thank you.

Hi @victorialim

Try the below expression in if condition.

Convert.Toint(ReadCellvalue1)<Convert.Toint(ReadcellValue2)

Then send mail.

Regards

Thank you. Can I confirm how should I fill up the assign activity or there is no need for it?
And for read cell, the variable type should be int or string or just data table?

Thanks!

Hi @victorialim

From the above screen shot assumed that you re getting the value from the read cell it seems?

If my assumption is correct the outvalue from the read cell is TypeGeneric not datatable

Convert the Out value to integer and Use if condition no need of assign.

Regards

I can use if condition instead of assign activitiy

Well u can use the assign activitiy for storing the Boolean results out of condition and use that variable in if activity

Also please note to store the output of Read Cell activitiy in Generic datatype rather than a fixed datatype and convert it to required datatype for later use

Regards

Nived N :robot:

Happy Automation

1 Like

Hi @victorialim

Let me know if its work for you?

If works mark solution to desired post.

Regards

Hi,

just created a sequence which compare cell A1 with another number in cell B2.

Let me know if you need any further information.

Main2.xaml (8.9 KB)
ExcelFile1.xlsx (9.2 KB)
ExcelFile2.xlsx (9.1 KB)

1 Like

Thank you all! Worked after I changed to generic variable type.

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