How to compare If Condition with excel values

Hi Team,

Good Day!

How to compare if condition with excel values example as below:

I want to the give the value(8) from Excel

row(0).ToString.Length <8(I have more if conditions,so i want to pass these values from excel)

@RajeshT - Can you please explain in detail what you want to compare ?

okay @RajeshT ,

Try this condition.
row(0).ToString.Length < Cint(row(1).ToString)

Cint(row(1).ToString) —> will get value from 2nd coulmn and convert it to Integer.
As you want it. :slight_smile:

1 Like

You can use For Each activity to compare all the values.

Use Read Range activity to read the excel into a datatable say DT.

For Each row in DT
    if row(0).ToString.Length < Int32.Parse(row(1).ToString) Then
1 Like

Hi @samir,

Thank you for the response.
I am comparing this part from Excel1 Sheet1 --row(0).ToString.Length
And this part from from another Excel2 Sheet1–CInt(row1(1).ToString)
If so willl the below flow is correct?

1 Like

Yah of course
but ensure that once the match is found in the inner for each within IF condition else it will keep on looping so for that in the THEN part of if condition in the inner for each row loop use a BREAK activity

Cheers @RajeshT

1 Like

Getting below error:

Hi @samir @Palaniyappan ,

Datatable i have mentioned wrogly thats what i got that error,but am facing the other issue after fixing that:

I think actually no, because this will compare 1 value from 1st excel to the all values from 2nd excel, Like cross product cartesian.

So, I’ll suggest you to make index variable for both for each row activity as ind1 and ind2 resp. and make sequence as given below.

  1. If activity to make sure both having same indexes. ind1=ind2
  2. If activity in then, to apply condition. row(0).ToString.Length < CInt(row1(0).ToString)
    CInt(row1(0).ToString) —> i’ve mentioned index 0, for colmn 1st. make sure you give proper index for column.


1 Like

Hi @samir,

What is variable type for Ind1 and Ind2?


Use ctrl+k it’ll automatically create it in int32

Hi @samir ,

I am getting same error,could you please look in to my (11.9 KB)

hey @RajeshT,

Here’s an example —> (19.8 KB)
Check the excel file having sheets of data & Run it.

length < 8
image image image

1 Like

This works Perfectly @samir.

Thanks a ton!!

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