If Condition is wrongly Working

Hi all,

Excel Name - Process Report (I will Provided Same data)

Age Identifier
3.13
4.10
5.50
0.10
10.1
22.5
30.1
40.9

Here Identifier Column is filled automatically according to the Condition,
Condition
If age>4.5 = Risk
if age >=4 and age <4.5 = 4
if age >=3.5 and age <4 = 3.5
if Age >=3 and age <3.5 = 3
if Age >=2.5 and age <3 = 2.5
if age >=2 and Age <2.5 = 2
if Age >=1 and age <2 = 1
Else
0

I have Read the Excel and Iterated through “For Each Row” then i go the below Output,

Age Identifier
3.13 3
4.10 4
5.50 Risk
0.10 0
10.1 1
22.5 2
30.1 3
40.9 4

For last Four Row’s …I should get “Risk” but it is giving Value. I am not sure where i went Wrong can any one help me on this one ?

[I guess for last Four it is Considering like "10.1 as “1.1” Soon… this is Causing issue but all my conditions are clear]
@NIVED_NAMBIAR - Can you please give many solution for this how you gave for previous one ?

@Jayavignesh_G - is it possible to share the sample data in a sheet ? And also please show your if condition in a screenshot?

So, I can’t.

Read Range → Dt

For Each Row

Row in Dt
row.item(“Age”).ToString=“4.5” then Risk
Else
if
row.item(“Age”).ToString>=“4” and row.item(“Age”).ToString<“4” the 4
else
if
so on… Rest of all Condition

@Jayavignesh_G …try cdbl(row(“Age”).tostring) < 4.5

cdbl - ??

convert.todouble

@Jayavignesh_G - Please check my output here…

image

My workflow…

Hope this helps…

Output if i compare the numbers as string(which you should not)

image

image

@Jayavignesh_G - please let me know if the above solution is working for you?

Yes It is working … Thanks !!

1 Like

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